简体   繁体   中英

How to receive call on android + pjsip when phone in deep sleep

I'm trying to build voip app based on PJSIP on Android. I decided to use TCP for connection to make the connection be persistent. And app right now has background service (same process) which is responsible for all interactions with SIP server. TCP keep alive timeout is set to 1 minute (just for testing purposes). Everything works fine until the moment when phone goes into a deep sleep mode. From logs I see that phone still sends TCP KA but with 4 minutes interval (why???). But the main issue is if I try to call from another phone to this one the phone keeps sleeping and skips all INVITE messages. Appreciate any help.

When the Android device goes into deep sleep, the CPU throttles down and almost all OS services are suspended. See for example:

If this were not the case, the OS and most other components would still be on, which would drain battery extremely fast, and most users would uninstall your app.

In order to receive incoming messages (such as the INVITE), it's recommended to use GCM . In this, you need to implement a server piece that is essentially handling the client's responsibilities while the client device is asleep.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM