问题
I'm using flutter_beacon for detecting iBeacons in one of my flutter project. Its working fine in foreground and in background for android version below 8. But its not detecting beacons in background for android version 8 and above.
As per background location limits: Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.
I've also reported an issue to github with the example code here
Is there any extra code I have to write in order to make android device with version 8+ be able to detect beacons in background ?
回答1:
What you are trying to do is Restricted According to this : https://developer.android.com/about/versions/oreo/background-location-limits
BUT, according to the same doc, you Can do what you need to do only if your app has one of these,
- It has a foreground service.
- Input method editor (IME)
- Wallpaper service
- Notification listener
- Voice or text service
you can go with 1st or 3rd one but it requires some platform specific coding.
来源:https://stackoverflow.com/questions/62232482/flutter-ranging-beacons-in-background-android-8-0