-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monitoring not working after app is killed #1110
Comments
Please see this page from the library documentation: https://altbeacon.github.io/android-beacon-library/resume-after-terminate.html Is what you are witnessing different from what is described there? Please note the specific ways apps can be stopped and later restarted by the library as described on that page, then update this issue with details. |
After consulting the page, I tested it again and it seems to be launching the app correctly after termination. However, if we look at my code :
When the app is launched automatically in background, the sendRequest() in onCreate() is called correctly but the sendRequest() in monitoringObserver is never called. Is this normal? I'm trying to make an app where I will be running ble scans in the background. |
Let's clarify this:
Understand that the monitoring observer won't be called again (even if the app is killed and restarted) until the state changes from INSIDE to OUTSIDE or back, and this can take up to 25 minutes for the reasons described above. It is possible to disable state preservation with the app so you do get a new call to monitoringObserver if the app is killed and restarted. But by default you do not get a call if the state does not change even after app restart. |
sendRequest in monitoring observer is called when the app is opened, but not when killed (after re-launch).
|
I think the easiest way to address this problem is for you to call: beaconManager.setRegionStatePeristenceEnabled(false) You can see details here: https://altbeacon.github.io/android-beacon-library/state-persistence.html |
Expected behavior
I should receive a post request to my api when the device detects ble beacons. I receive the request correctly when the app is opened, but when it is killed, I don't receive the call.
Actual behavior
I don't receive any request.
Steps to reproduce this behavior
class CustomApplication : FlutterApplication() {
companion object {
private const val TAG = "CustomApplication"
}
}
Mobile device model and OS version
Google pixel 5, Android 13
The text was updated successfully, but these errors were encountered: