I am developing a little VoIP application and i need to stay connected to the server.
A was using push notifications at first (to wake up the device on incoming call), but android push notifications are not reliable due to very long heartbeat interval.
The second solution was to use a service with startForeground()
. This method works, but leaves an icon in the notification bar (i know it's the way it should be, but please read on).
If i don't use startForeground()
then service falls asleep as soon as te phone sleeps.
TLDR:
Viber has a background service without startForeground()
but it still works if the phone is sleeping and accepts incoming calls (even with push notifications disabled). How did they do that?