Answer the question
In order to leave comments, you need to log in
What to use to wait for data?
What I want to do is: some script/application is waiting for an incoming signal and transmitting its data. It should work for many days and rarely receive signals. The easiest way is to make requests every few seconds to the server, checking if the data is. To put it mildly, not optimal. Web socket, long pull are less resourceful, but also less reliable, despite the fact that they actually make the same constant requests at a different level (maybe I'm wrong?). Maybe there is some special technology for this task?
Answer the question
In order to leave comments, you need to log in
1 option. Initiation of the connection by the server, the server sends a push, the device receiving the push sends a request to the server for data and the server sends them.
Option 2. WorkManager aka AlarmManager - the application sets a specific schedule for the launch of a separate process for the system, after which the application can be closed, the device is rebooted - the process will be performed until the program is deleted (or its settings are reset).
must work for many days. After this point, you can forget about android.
a) Automatically revoke granted permissions to the application
b) Restrict background work. Up to 1 time per day access to the Internet if the application was not opened
Only the possibility of receiving a push remains.
A notification may remain unnoticed
In terms of labor intensity, reliability, it is easier to send a message to instant messengers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question