I would like to listen for a Puck.js message in background using Android. Currently I have the problem that BLE scans for advertisements stop after some time (1-2 minutes). What is the recommended way to read a message send by the Puck.js in a background service?
I'm afraid I don't have any real experience of Android's BLE scanning - maybe someone else will be able to jump in here.
However perhaps just scanning for a few seconds every minute would be enough? I imagine it might cause considerable battery drain scanning all the time.
To get it 100% reliable I guess you may be able to just connect and keep the connection open rather than using advertising? Newer versions of Espruino (at least 2v01 and above, probably before) are pretty efficient when connected.
You may also have some success modifying your Puck.js to broadcast an Eddystone packet - I don't know if Android will give your app a little more control over scanning in that case?
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem