My VOIP Android Application has the C/Native Library which does all business logic of login/Logout etc.
Issue with this is when the device screen is locked the application(c Code) is not able to receive any packets from the server. I verified this with Wireshark. It looks like the CPU is not running.
I was able to solve the issue doing below on my application INIT.
WakeLock mWakeLock = null;
PowerManager pm = (PowerManager) cxt.getSystemService(Context.POWER_SERVICE);
if(mPartialWakeLock == null){
// lock used to keep the processor awake.
mPartialWakeLock = pm.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK
| PowerManager.ON_AFTER_RELEASE, TAG);
mPartialWakeLock.acquire;
}
But doing above will drain my battery.
Why the requests are not reaching my application? How can I make device CPU up all time when Screen is LOCKED and receive requests from the Server?
Note: EDITED Device Used: Samsung Rugby Smart i847 OS : Android OS, v2.3.6 (Gingerbread.UCLA4)
The the application works on Galaxy s2.(Is it because its Dual Core Processor and CPU is up on Screen LOCK?) How Does SKYPE and VIBER designed WRT to Sleep Mode??