Hi, Where is the PHONE_STATE_CHANGED Intent defined? I can't find it anywhere in the documentation and am in a situation similar to Bnet's. I'm trying to get my Activity to pop-up when an incoming call occurs, I don't like the default view and want my own instead (I wish to display extra data about the callee than currently displayed).
Thanks, Marc On 3 mar, 20:25, Marco Nelissen <marc...@android.com> wrote: > On Tue, Mar 3, 2009 at 9:09 AM, Bnet <tcb...@gmail.com> wrote: > > > I'm trying to call the SoundNotification.java from the > >PhoneStateListenerto test a default system notification sound. When a > > missed call state is true, the SoundNotification.java is called to > > play the sound or beep. I understand your point about the receiver > > dropping thephonestatelistenerand appreciate the feedback. Thanks > > again. > > OK, so it sounds like *what* you want to do (your MyPhoneStateListener > and SoundNotification classes are part of *how* you want to do it) is > to play a sound when a call is missed. > So first you need to figure out if a call is missed. There are a > number of ways to do that. You were trying to do this by using > aPhoneStateListener, which is fine, but I don't think you actually need > it. You already have a receiver for the PHONE_STATE_CHANGED Intent > broadcast, and that Intent already contains an 'extra' that tells you > the current state, so you shouldn't need to set up aPhoneStateListener. > Then, since you're determining whether a call was missed by > idle-ringing-idle transitions, you'll need some place to store the > intermediate states, so that when the call state goes to idle again, > you can check whether the previous state was offhook, and if not, play > the sound. > You could use a Service to keep track of the intermediate states, but > a simpler solution might be to store/retrieve the previous state using > a SharedPreference. However you want to do it is up to you, but you > shouldn't rely on the broadcast receiver itself keeping any state for > you. Once you've determined that a call was missed, you play the > sound, probably using MediaPlayer. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---