androidbeaconaltbeacon

An error occurs in the Altbeacon scan function. When using Android API version 30 or higher


According to the Google Play Market distribution standard, developing using Android API target version 30 or higher.

When trying to use the Altbeacon scan function, the error below occurs.

error : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:382) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673) at android.app.PendingIntent.getBroadcast(PendingIntent.java:660) at org.altbeacon.beacon.service.scanner.CycledLeScanner.getWakeUpOperation(CycledLeScanner.java:529) at org.altbeacon.beacon.service.scanner.CycledLeScanner.cancelWakeUpAlarm(CycledLeScanner.java:541) at org.altbeacon.beacon.service.scanner.CycledLeScanner.setScanPeriods(CycledLeScanner.java:192) at org.altbeacon.beacon.service.ScanJob.restartScanning(ScanJob.java:267) at org.altbeacon.beacon.service.ScanJob.startScanning(ScanJob.java:312) at org.altbeacon.beacon.service.ScanJob.access$600(ScanJob.java:43) at org.altbeacon.beacon.service.ScanJob$1.run(ScanJob.java:110)

Mobile device model and OS version ANDROID Galaxy S10E

Android Beacon Library version android-beacon-library-2.17.1.

For Android version 30 or lower, the beacon scan function works normally.


Solution

  • This problem was fixed here and is in release 2.19+. Please upgrade to that library version to resolve this problem.