Is possible to use NearBy API with out Proximity API?

久未见 提交于 2020-01-06 11:02:55

问题


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



来源:https://stackoverflow.com/questions/33874431/is-possible-to-use-nearby-api-with-out-proximity-api

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