-->

Is possible to use NearBy API with out Proximity A

2019-09-12 04:18发布

问题:

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