Hi, I think I got this straight. Now an other problem - I want to use the 'onCallStateChanged' function to launch my app screen when a call ends. How do I bring my app to the front ?
TIA On Oct 9, 8:22 pm, chouman82 <[EMAIL PROTECTED]> wrote: > Can anyone give a simple example of the usage of PhoneStateListener? > > I have tried to overwrite the listener and register it with the > TelephonyManager with the Context.TELEPHONY_SERVICE. > > But i only saw my logging statement printed out right when I started > to run the application. The logging showed the PhoneState as IDLE. > But then after that when I use telnet to emulate an incoming call, I > don't see the logging statement been printed for PhoneState - RINGING > or PhoneState - OFFHOOK. > > here is my code snippet: > TelephonyManager tm = > (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); > tm.listen(this, CallStateListener.LISTEN_CALL_STATE); > > public void onCallStateChanged(int state, String incomingNumber) > { > switch(state) > { > case TelephonyManager.CALL_STATE_DLE: > Log.d(DEBUG, "PHONE STATE - IDLE"); > break; > case TelephonyManager.CALL_STATE_OFFHOOK: > Log.d(DEBUG, "PHONE STATE - OFFHOOK"); > break; > case TelephonyManager.CALL_STATE_RINGING: > Log.d(DEBUG, "PHONE STATE - RINGING"); > break; > } > > } --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---