根据官方文档提供的解决方案,需要对BluetoothMedic库进行升级以解决在Android 12和13上的崩溃问题。升级方法如下:
implementation 'org.altbeacon:android-beacon-library:2.20+'
implementation 'org.altbeacon:bluetooth-medictools:1.0.5+'
BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
BluetoothMedic medic = new BluetoothMedic(this, beaconManager);
medic.enable();
beaconManager.unbind(this);
medic.disable();