admin管理员组

文章数量:1391929

I am using the reference app () without any modifications except for the following:

// beaconManager.setEnableScheduledScanJobs(false);
beaconManager.setBackgroundBetweenScanPeriod(0);
beaconManager.setBackgroundScanPeriod(1100);

// Ranging callbacks will drop out if no beacons are detected
// Monitoring callbacks will be delayed by up to 25 minutes on region exit 
beaconManager.setIntentScanningStrategyEnabled(true)

I am testing it with an iBeacon on a Redmi Note 8 Pro running Android 11.

If the reference app is open, it works fine. However, if it is moved to the background (without closing the app), the logcat simply stops printing any logs after about a minute.

As soon as I reopen the app, the log continues, and the iBeacon is detected again.

What could be happening?

I expect the scanning to continue when the app is in the background, but the app simply goes to sleep.

I am using the reference app (https://github/davidgyoung/android-beacon-library-reference-kotlin) without any modifications except for the following:

// beaconManager.setEnableScheduledScanJobs(false);
beaconManager.setBackgroundBetweenScanPeriod(0);
beaconManager.setBackgroundScanPeriod(1100);

// Ranging callbacks will drop out if no beacons are detected
// Monitoring callbacks will be delayed by up to 25 minutes on region exit 
beaconManager.setIntentScanningStrategyEnabled(true)

I am testing it with an iBeacon on a Redmi Note 8 Pro running Android 11.

If the reference app is open, it works fine. However, if it is moved to the background (without closing the app), the logcat simply stops printing any logs after about a minute.

As soon as I reopen the app, the log continues, and the iBeacon is detected again.

What could be happening?

I expect the scanning to continue when the app is in the background, but the app simply goes to sleep.

Share Improve this question asked Mar 12 at 18:03 Jose BravoJose Bravo 1
Add a comment  | 

1 Answer 1

Reset to default 0

Xiaomi and Redmi branded phones are notorious for killing apps in th background whether they are doing Bluetooth beacon scanning or anything else.

While you are unlikely to get background beacon detection apps working well for general users with on these heavily non-standard Android phones, you maybe able to modify your phone's settings so you can use it for development.

Please try some of the configuration techniques here to see if any of them help. https://dontkillmyapp/xiaomi

本文标签: Android AltBeacon Library detecting Stoping on Background as IntentStack Overflow