Oh, ok thank you. I will rephrase, when you run an app it goes through
the the android app life cycle. Lets say my activity that contains the
listener is terminated, will it start running and do what it needs to
if the phone rings? That is if its not a service...

On May 25, 11:56 am, Mark Murphy <[email protected]> wrote:
> GT wrote:
> > Actually I was thinking, would a service be the way to go? Because
> > won't my app start(or do what I want it to) if I use the PhoneState
> > Listener?
>
> I do not understand your question, but let me see if I can address it by
> pointing out a problem in your code.
>
> If you call:
>
> telephonyManager.listen(phoneListener,
> PhoneStateListener.LISTEN_CALL_STATE);
>
> Then at some point, you also need to call:
>
> telephonyManager.listen(listener, PhoneStateListener.LISTEN_NONE);
>
> If you fail to do so, your listener will receive events, forever and
> ever, until your process is terminated.
>
> Hence, in onDestroy(), you should set your listener to LISTEN_NONE.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Looking for Android opportunties?http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to