On 01/29/2015 09:38 AM, Roberto Fichera wrote: Hi All, I'll answer myself since I've found the solution! Actually I've replace the pjlib/src/pj/timer.c with a version coming with csipsimple. The idea is to map the pjsip timer events in terms of android alarm events. So far so good, I've just added 3 new C functions timer_schedule(), timer_cancel() and timer_fire(). The first 2 will call the related java methods that are performing both scheduling and cancel() timer function in terms of android alarms. Finally the timer_fire() is a JNI function used to trigger the callbacks associated to the given low level pjsip event. This function is called from a PendinIntent associated to the given alarm event as soon as it expires. With this logic, I'm actually getting consistent re-registration and availability with roughly 10% of more battery drain event the phone is in deep sleep mode. Cheers, Roberto Fichera. > All, > > Just a "simple" question, how do you guys handle re-registration, invites and > keep-alives in android when the phone is in deep sleep mode? > > I've tried many techniques but I'm still not getting a reliable way to keep the > phone registered. My current app uses a native library to simplify > the pjsip API access from java and all the pjsip callbacks I need are just > calling back some java methods to get notified the app regarding some events. > > Everything works just fine if I keep the phone connected to USB. As soon > as I unconnected it from USB the app keep connected and reachable up to the > next re-registration which doesn't complete because the phone entered in deep > sleep mode. > > I've also tried to grab the partial wakeup lock from a JNI callback in order to > wakeup the phone at each invite and re-registration events, but seems not really > working, the phone still enter in deep sleep mode and never re-register. > > A semi-reliable way I've found is to set a repetitive timer to wakeup the phone, > just for few seconds, to complete the re-registration process. But this has the > drawback of battery drain problem. > > Does anyone has a better approach to get reliable re-registrations and reachability > on android application when the phone is in deep sleep mode? I really like to know > if someone has sorted out this problem. > > Thanks in advance, > Roberto Fichera. > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >