1

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

sarra.srairi
  • 150
  • 14

3 Answers3

2

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)

Andrew Bunner
  • 235
  • 1
  • 7
  • Thanks Andrew..I checked with BLE scanning app and the beacons are broadcasting and also i followed the first two steps listed by you . Iam using the same code in the github example and was able to detect the android devices in the proximity. To discover beacons I modified the subscription method Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, PUB_SUB_STRATEGY) to Nearby.Messages.subscribe(mGoogleApiClient, messageListener, Strategy.BLE_ONLY).. – user5197215 Sep 14 '15 at 06:10
  • 1
    Nice! Glad you solved it. I updated my answer above to mention Strategy.BLE_ONLY ... we've made sure the code on our [beacon page](https://developers.google.com/nearby/messages/android/get-beacon-messages) reflects that – Andrew Bunner Oct 10 '15 at 14:23
  • Sorry Andrew, I did not comment properly. I meant to say , even after trying , I could not detect the beacons. – user5197215 Oct 26 '15 at 05:40
  • Did you use the same dev console project id in the calls to the Proximity Beacon Service as you're using in the subscribing app? By default beacon attachments are ACL'd to just your project--the app has to have an API key associated with the same project that you used when adding the attachments. – Andrew Bunner Oct 27 '15 at 15:47
1

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.

Joe Farfel
  • 136
  • 2
0

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.

JimBobBennett
  • 2,149
  • 14
  • 11