I'm using a beacon that can work either with iBeacon or Eddystone, I create a scanner that has a service in the background which scans each 10 secs for beacons, similar to the android-beacon-library, but I was thinking that I could use the NearBy API to get the beacons with out the scan service, Is that possible?, I don't want to use the ProximityAPI to register the beacons because these beacons will be out there with out the need to register them.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
In order to use the Nearby API, your beacons must both be registered with the Google cloud, and have attachments as described here.
The way the Nearby API works, you create a MessageListener
and subscribe to get callbacks when beacons are found with messages attached to them:
When subscribing, your app will automatically receive any messages that you've attached to BLE beacons, in addition to any messages published by your app on other devices.
https://developers.google.com/nearby/messages/android/get-beacon-messages
If there aren't any messages attached to them, you won't get any callbacks