How does the pushy.me service sdk work on Android? I'm specifically interested in how continuous delivery of notifications is ensured? Does he need any additional permissions or something like that? Why is the background process not killed by the system?
How pushy.me service work on android? How is continuous delivery of notifications ensured?
76 Views Asked by Student4543 At
2
There are 2 best solutions below
1

Most probably use silent push notifications (so the receiver can awake on it). It doesn't provide any guarantees though, but usually is quite stable.
You can't keep any service running in background as latests Android versions will throttle / kill it. The recommended WorkManager
API is too restrictive.
The background process is not killed by the system, because services were not intended to be killed, unlike for example, an app. They fill that role in the Android operating system.
As for how continuous delivery of notifications is ensured, there's three ways that are possible and one that is most likely.
1. Short polling
The service sends a request on a regular interval for the current data on recent notifications, and displays those that it hasn't already. The drawback being, you have to serve a substantial number of requests to ensure function, and you aren't getting true continuous delivery.
2. Long polling
The service sends a request with a long timeout period and the server holds the request until an update is made, at which point it will respond with the updated data. If it times out, another request is sent by the client. The drawback here is that the request needs to be held, frozen, until data is updated, locking up resources.
3. Web Sockets
The likely solution for this. In regular HTTP, the server needs to be queried for data. Web sockets allow bidirectional communication that is only terminated when one side closes the connection, not after every query is served. As such, the server may communicate to the client unprompted. It doesn't need an incoming request to specify an address to return the response to.
See: this.