Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nearby API, what's the correct way of scanning for beacons in the background?

I'm looking at using Google's Nearby API to detect beacons (Eddystone). The only current approach at the moment seems to be calling Nearby.Messages.subscribe() as described here.

The problem is that this doesn't seem to be suitable for continuous scanning in the background. My app needs to keep monitoring beacons in the background so if one becomes visible, it would perform a call to a REST API. Basically, I'd need something similar to the beacon monitorning feature provided by the Estimote SDK.

Would this be possible to achieve with the Nearby API without draining the battery?

like image 446
ivacf Avatar asked Oct 20 '15 13:10

ivacf


1 Answers

I realize this question is about how to use the Nearby API, but I don't know of a way to use it to meet your requirements.

If you are open to alternatives, the free and open source Android Beacon Library has full support for Eddystone beacons. Its API is modeled after the iOS monitoring/ranging beacon APIs, so it will do precisely what you want.

See here for how to use this library to monitor for Eddystone beacons.

like image 142
davidgyoung Avatar answered Oct 14 '22 14:10

davidgyoung