On Thu, Sep 10, 2009 at 5:40 PM, Mark Murphy <mmur...@commonsware.com>wrote:
> > Android Development wrote: > > Only when i start receiving packets from the underlying IP Connectivity > > Network and my protocol listeners intercept the messages,then i want to > > re-start these other services. > > I do not know your application or what it is trying to achieve. I would > recommend, though, that you use the Five Why's to determine the root > cause for needing the above requirement, because that requirement is > going to be the cause of your difficulty in terms of power management > > http://en.wikipedia.org/wiki/5_Whys > > For example, as Ms. Hackborn pointed out elsewhere in this thread, the > phone will always try to maintain a data connection, whether WiFi or > cellular data. There are plenty of scenarios where you would lose data > connectivity (driving out of signal area, driving through a tunnel, user > turns on airplane mode), but I am not convinced any of them happen > frequently enough and are important enough that you need to find out > *immediately* when they occur. Perhaps you do -- again, I do not know > your application. > Ok, i will tell what the application is supposed to do. It is a SIP client. As per the standard procedures that i am following, whenever there is loss of radio connectivity with the base station / data connectivity with the underlying IP network, I need to clean up my SIP registration state and any transient state that may have been maintained (eg: if a call was in progress then i need to clean up the call state, state maintained due to subscription to network side resources etc). So, basically its a clean up job. Subsequent to this clean up, i have to log the user out of the application and present the Login screen to him/her. > > But, if you can drop the requirement of having to react immediately upon > a data connectivity change, then perhaps you can just let the device go > to sleep and only take action on a periodic basis via AlarmManager > (e.g., once an hour). > This is also a possible alternative. But if this connectivity was lost during the course of a SIP call, then i need to 'drop' the call, clean up its FSM and stop RTP flow. > That's why I was inquiring about the business goals -- it's one way I > try to steer people in a Five-Why's-style analysis. It may be that the > true business goal is to know, within milliseconds, whether you have > data connectivity. However, if that is not the true business goal, then > you may be expending a whole lot of effort fighting Android where it is > not needed. > I appreciate the systematic approach. I liked that link. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android Development Wiki: http://wiki.andmob.org > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---