I'm trying to call the SoundNotification.java from the PhoneStateListener to 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 the phonestatelistener and appreciate the feedback. Thanks again.
On Mar 3, 10:50 am, Marco Nelissen <marc...@android.com> wrote: > On Mon, Mar 2, 2009 at 4:36 PM, Bnet <tcb...@gmail.com> wrote: > > > Okay Thanks. In regards to having a Context to call startActivity(), > > does it make sense to move the SoundNotification to the > > ServiceReceiver as shown below? I can't seem to basically call a > > subroutine. > > > public class ServiceReceiver extends BroadcastReceiver { > > > �...@override > > public void onReceive(Context context, Intent intent) { > > > MyPhoneStateListener phoneListener=new > > MyPhoneStateListener(); > > TelephonyManager telephony = (TelephonyManager) > > context.getSystemService(Context.TELEPHONY_SERVICE); > > telephony.listen > > (phoneListener,PhoneStateListener.LISTEN_CALL_STATE); > > > Intent i = new Intent > > ("com.bnet.detectmissedcall.SoundNotification"); > > context.startActivity(i); > > > } > > } > > I'm not sure what you're trying to do there. You're still creating > your PhoneStateListener locally in your Receiver, which is not a good > idea. > It might help if you tell us what you're actually trying to do.- Hide quoted > text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---