Answered my own question...

            telMgr.listen(myPhoneStateListener,
 TelephonyManager.CALL_STATE_IDLE
            | TelephonyManager.CALL_STATE_RINGING |
            TelephonyManager.CALL_STATE_OFFHOOK);

is wrong.  This is right:

telMgr.list(myPhoneStateListener,
PhoneStateListener.LISTEN_CALL_STATE);

of course -

one still uses TelephoneManager.CALL_STATE_IDLE in
onCallStateChangedChanged so it's a bit tricky.  Hey Google, Java has
enums yes?

On Nov 13, 4:24 pm, dreamerBoy <[EMAIL PROTECTED]> wrote:
> I didn't forget:
>
> <uses-permission android:name="android.permission.READ_PHONE_STATE"></
> uses-permission>
>
> On Nov 13, 4:09 pm,dreamerBoy<[EMAIL PROTECTED]> wrote:
>
> >     private class MyPhoneStateListener extends PhoneStateListener
> >    {
> >       public void onCallStateChanged(int state, String incomingNumber)
> >       {
> >          log("listener call state: " + phoneStateToString(state) + " "
> > + new Date());
> >       }
> >    }
>
> >    MyPhoneStateListener myPhoneStateListener = new MyPhoneStateListener
> > ();
> >    /*
> >           * telMgr.listen(myPhoneStateListener,
> > TelephonyManager.CALL_STATE_IDLE
> >           * | TelephonyManager.CALL_STATE_RINGING |
> >           * TelephonyManager.CALL_STATE_OFFHOOK);
> >           */
> >          // let's try this...
> >          telMgr.listen(myPhoneStateListener,
> > TelephonyManager.CALL_STATE_IDLE);
>
> >          telMgr.listen(myPhoneStateListener,
> > TelephonyManager.CALL_STATE_RINGING);
>
> >          telMgr.listen(myPhoneStateListener,
> > TelephonyManager.CALL_STATE_OFFHOOK);
>
> > Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:
> > 1234567"));
> > thisActivity.startActivity(myIntent);
>
> > I can see the call definitely get placed on the emulator - however, no
> > PhoneStateListener callback.
>
> > I can always resort to polling with
>
> > telMgr.getCallState()
>
> > but it's not as elegant as a callback - anyway, wondering what's up.
>
> > -dreamer
>
>
--~--~---------~--~----~------------~-------~--~----~
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