在后台颤动测距信标-Android 8.0 [英] Flutter ranging beacons in background - Android 8.0

查看:117
本文介绍了在后台颤动测距信标-Android 8.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 flutter_beacon 在我的一个Flutter项目中检测iBeacon.对于低于8的android版本,它在前景和后台都能正常工作.但是对于高于8的android版本,它无法在后台检测信标.

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.

根据背景位置限制:Android 8.0( API级别26)限制了后台应用可以检索用户当前位置的频率.应用每小时只能接收几次位置更新.

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.

我还用示例代码在这里

为了使版本8+的android设备能够在后台检测信标,我是否还需要编写其他代码?

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 ?

推荐答案

根据此操作,您尝试做的是受限的:

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. 它具有前台服务.
  2. 输入法编辑器(IME)
  3. 墙纸服务
  4. 通知侦听器
  5. 语音或文字服务

您可以选择第一个或第三个,但是它需要一些特定于平台的编码.

you can go with 1st or 3rd one but it requires some platform specific coding.

这篇关于在后台颤动测距信标-Android 8.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆