0

I have followed the ten steps outlined in the Hello Beacon app tutorial at https://codelabs.developers.google.com/codelabs/hello-beacons/.

when i turn on the app for a few seconds (maybe 10sec) it tries to find beacons and lists the beacons found but after that even if i turn off the beacon or turn on new beacons there is no response or no new messages are recieved in the app . Unless i exit to main screen(home screen) and turn on the activity again is when the changes to beacons are detected. Is there some issue with the code or is it hardware.. I use nexus 7 2013(android 6) for the app. And beacon simulator for virtual beacons on moto g4 (android 7)

user rk
  • 376
  • 5
  • 13

1 Answers1

0

If you look at the tutorial, it writes out the beacons in onCreate(). This only happens once when the app is run. You need to modify the app to either have a timer to repeatedly get the beacons or, better still, cause beacons detected by the BackgroundSubscribeIntentService to show in the UI. You can do this by binding the activity to the service and receiving callbacks into the activity whenever there are new beacons detected.

Simon Judge
  • 302
  • 1
  • 3
  • 11
  • i think they are able to do it without binding the activity to the service because in the video https://www.youtube.com/watch?v=0QeY9FueMow&t=1718s they are doing it with the similar code as used above. the code is https://gist.github.com/hoitab/9a68f87cd9e7d4da2e6c . I think nearby.messages.subscribe handles all the detection and starts the service when detection is successful . i just dont know why its not working on my device. – user rk Aug 11 '17 at 08:41
  • If your above answer is correct can you explain it further (i am not able to understand why the original codelab is working for them and not for me) Maybe i am missing something . Please help.thanks – user rk Aug 11 '17 at 08:44
  • in the video https://www.youtube.com/watch?v=0QeY9FueMow&t=1718s at around 30:00 min there is a working demo – user rk Aug 11 '17 at 08:48
  • 1
    The demo is using different code. That code subscribes to nearby messages in the UI rather than service code which you can also do. – Simon Judge Aug 11 '17 at 09:33