蓝牙低功耗的Android - 搜索在后台 [英] Bluetooth Low Energy Android - Search in Background
问题描述
我想知道是否有可能在背景中,以检查是否有人进入或离开灯塔地区?
I would like to know whether it is possible to check in the background if someone enters or leaves the a beacon Region?
在iOS中,例如,你可以使用的方法 didEnterRegion
或 didExitRegion
从后台发送通知。
In iOS for example you can use the methods didEnterRegion
or didExitRegion
to send notifications from the background.
有没有本地可能性或者有别人的变通方法?
Is there any native possibility or has someone a workaround?
推荐答案
Android不具备任何本土化iBeacon显示能力可言,但你可以使用我公司的开放源码看到iBeacons的 Android的iBeacon显示库,它具有类似的API与天然到iOS 7。
Android doesn't have any "native" iBeacon capability at all, but you can see iBeacons using my company's open source Android iBeacon Library, which has APIs similar to those native to iOS 7.
在iOS版的情况下, CLLocationManagerDelegate
,您可以访问到 didEnterRegion
和你描述didExitRegion
回调。在Android iBeacon显示库,相当于是 MonitorNotifier
界面,让你同样的回调方法。
In the case of iOS, the CLLocationManagerDelegate
gives you access to the didEnterRegion
and didExitRegion
callbacks that you describe. In the Android iBeacon Library, the equivalent is the MonitorNotifier
interface that gives you the same callback methods.
使这些回调成功发射对于那些没有在前台应用程序上均iOS和Android有点棘手。在Android上,你需要开始,当Android设备启动运行你自己的服务,并绑定到IBeaconManager在该服务。
Making these callbacks successfully fire for apps that aren't in the foreground is a little tricky on both iOS and Android. On Android, you need to start a service of your own that runs when the Android device starts up, and bind to the IBeaconManager in that service.
这一设置是不是超级简单的,所以我们开发了一个专业的Android iBeacon显示图书馆自动做这一切。例子是这里。
Setting this up isn't super easy, so we developed a Pro Android iBeacon Library that does all this automatically. Examples are here.
这篇关于蓝牙低功耗的Android - 搜索在后台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!