I attached data to Eddystone Beacons using The Proximity Beacon API. I want to fetch the Beacon attachments using Nearby Messages API.
I followed the steps mentioned at https://developers.google.com/nearby/messages/android/get-beacon-messages.
But I am not able to read Beacon attachments. The onFound()
method is not getting called
Check the following...
Set a callback on the response to subscribe and call startResolutionForResult on the Status object if the Status was APP_NOT_OPTED_IN . See github example
Make sure you've enabled the Nearby API in the Developer Console for your app. Step 3 here
Use Strategy.BLE_ONLY in the call to subscribe
Finally, if none of these help, try a stand-alone BLE scanning app just to make sure the beacon is actually broadcasting.
If you want to post a more complete code sample, one of our engineers can take a look
(I work on the Nearby API)
Another idea: Make sure that the API key in your manifest is from the same Google Developers Console project that you used when you attached your data to the beacons. Beacon attachments are private to the project that created them.
Another suggestion for anyone else reading this question who is having problems connecting. Lifted from another answer:
This may sound like an odd thing - but try turning you wifi on and off. A lot of cheaper devices are really bad with bluetooth and fail to connect, but for some reason turning wifi off and on fixes it for a while.
I was having a similar problem - everything in my code was correct but not detecting beacons. I even tried with the manufacturers app, and theirs also couldn't detect the beacon (but their iPhone version did). I turned my wifi off, then back on again and the manufacturers app worked and so did mine.
来源:https://stackoverflow.com/questions/32453165/find-eddystone-beacons-using-nearby-google-api