Search code examples
androideddystonegoogle-nearbygoogle-beacon-platform

Hello Beacons detecting virtual beacon but not able to make continous beacon scans in foreground


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)


Solution

  • 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.