0
votes

We are using the altbeacon library for a few years now and up until android 7 we never had any issues with region enter/exits and ranging in the background. However with Oreo (testing with 8.1) things seem to change. With the app in the background, we now get 1 enter region, no ranging and no exit region events. Just to be sure, we used the android-beacon-library-reference implementation and see the same effect. No ranging, no region exits, and no region re-enters. Only the first enter-region is detected in the background ever.

In the foreground, everything works fine.

Is this to be expected in Android 8.0 / 8.1 and are ranging and exit events no longer possible? Or is there something we need to add?

Using the latest org.altbeacon:android-beacon-library:2.13.1

1

1 Answers

0
votes

You should get ranging and monitoring events normally on Android 8.1 if using library version 2.13.1 or higher. See below for new limits on background scanning in Android 8+, which may cause events to happen more slowly in some cases. If you are using an older library version, you will be missing these updates:

2.13 adds support for beacon scanning with the screen off on Android 8.1, which added a requirement for a scan filters.

2.12 adds support for background scanning on Android 8.

Know that Android 8 adds new limits on how often apps can run in the background for all puproses including scanning for beacons. Generally this means that an appt at is not visible on the screen can only do background work for a few minutes at a time evertly ~15 minutes. This means that in the background ranging updates may come only every 15 minutes or so. Monitoring updates will still be fast (if no beacons are around and then appear) but slow (taking ~15 minutes) if new beacons appear after some are already present or if all beacons in a region disappear.

If you have an app that needs to do near constant scanning in the background, you may need a foreground service letter to accomplish this with Android 8+.

Details on these new Android 8 limits are described here

If your experience is not consistent with the above, then there may be an app setup issue worth exploring in a follow-up question.