I'm implementing the google Nearby messages API and I need the publications to happen even in background with the screen off. I have noticed that the messages are received even when the app that sent it isn't in the foreground but not when the sender's phone is locked. In the documentation it is explained how the background scan works but not the publication of messages, is it possible? Thank you.
Asked
Active
Viewed 42 times
1 Answers
1
Im sorry, but from my investigations, this is not possible with the Nearby Messages API.

RealityExpander
- 133
- 1
- 8
-
Thanks for the help! What are your investigations about? Experimenting, I created a foreground service that calls the nearby publish function every minute and it works, roughly. I noticed that after many minutes of inactivity of the phone with the screen off, the messages are detected by another phone in a longer time, even almost 5 minutes. What do you think of this approach? Do you have any recommendations? – Niccolò Caselli Mar 12 '23 at 22:01
-
I have been reading the SO comments about the various methods, and I have moderninzed working (not pretty at the moment) versions on my github: github.com/realityexpander – RealityExpander Mar 12 '23 at 22:24
-
The problem is that the messages are only available when the screen is on due to power consumption issues. Its meant for short messages for short periods of time, like coming into a museum and having the app tell you about something naerby. Im really not sure the use case because its very limited, but really cool tech. – RealityExpander May 09 '23 at 05:45