Flutter ranging beacons in background - Android 8.0

大兔子大兔子 提交于 2020-06-25 06:41:13

问题


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,

  1. It has a foreground service.
  2. Input method editor (IME)
  3. Wallpaper service
  4. Notification listener
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!