[android-developers] Re: ACTION_PHONE_STATE_CHANGED working in 1.5 SDK?

2009-06-05 Thread Mark Murphy

john wrote:
 Has anyone been able to react to phone calls without
 registering a background service to poll the getCallState() method
 repeatedly?

In an activity, or an unfortunately-long-running service, you can use a
PhoneStateListener:

http://developer.android.com/reference/android/telephony/PhoneStateListener.html

Off the cuff, your BroadcastReceiver setup sure looks good, and there
are signs in the Android source code that Android is indeed broadcasting
that Intent, so I'm not quite sure what is going wrong there.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: ACTION_PHONE_STATE_CHANGED working in 1.5 SDK?

2009-06-05 Thread john

Thanks, I wasn't aware of PhoneStateListener. Of course, if I want my
program to work consistently I need to get this Broadcast Receiver
working. I've had some very bad experiences with long-running services
(they tend not to run very long)!

Everything in the documentation says to use Broadcast Receivers
whenever possible and to always avoid Services when your program isn't
doing anything. I would love to follow the recommended model if it
actually worked...

 In an activity, or an unfortunately-long-running service, you can use a
 PhoneStateListener:

 http://developer.android.com/reference/android/telephony/PhoneStateLi...

 Off the cuff, your BroadcastReceiver setup sure looks good, and there
 are signs in the Android source code that Android is indeed broadcasting
 that Intent, so I'm not quite sure what is going wrong there.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Warescription: Three Android Books, Plus Updates, $35/Year
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---