The main problem with communicating with an Android device, usually a smartphone, is that if it's connected only to the cellular network, its address is hidden due to the very nature of the connection between the cell tower and the phone
I recently ran into this problem, and aside from polling the phone to a server, the only effective methods are two:
- Firebase
- Mqtt
In my case, I used a locally installed Mqtt server to enable communication between multiple Android smartphones, both on a LAN and connected via the cellular network.
Communication via Firebase is THE ONLY WAY to communicate with a smartphone even when the screen lock is activated.
In this case, there are no other ways to send messages and make the phone's onboard program react.
Therefore, the Mqtt (normal communication) + Firebase (hig priority message) combination, in my opinion, is the best way to communicate with Android devices.