My application is making call. I need to be notified when that call is
being pickeed up by other side. So i used TelephonyManager and
PhoneStateListner as below. Basically i wanted to know data activity
status.

my code is as below.



public void register()
    {
        TelephonyManager tm=(TelephonyManager)getSystemService
(TELEPHONY_SERVICE);
        tm.listen(new CallState(this),
PhoneStateListener.LISTEN_CALL_STATE|
PhoneStateListener.LISTEN_DATA_ACTIVITY);

    }

The following is class which extends TelephonyManager


public class CallState extends PhoneStateListener
{
        Dialer dialer;
        public CallState(Dialer dialer)
        {
                this.dialer=dialer;

        }
        public void  onCallStateChanged (int state, String incomingNumber)
        {
                Log.e("state in onCallStateChanged",String.valueOf(state));
                Log.e(String.valueOf(state), incomingNumber);
                if(state==2)
                {
                        dialer.playAudio();
                }

        }
        //onDataConnectionStateChanged(int state)
        public void  onDataConnectionStateChanged  (int state)
        {
                Log.e("statte in onDataConnectionStateChanged", String.valueOf
(state));
//              if(state==TelephonyManager.CALL_STATE_OFFHOOK)
                {
                        //dialer.playAudio();
                }

        }
        public void onDataActivity(int direction)
        {
                Log.e("in onDataAcitvity",String.valueOf(direction));
        //      dialer.playAudio();
        }

}



It is invoking onDataActivity(int direction) only once and that time
its value is 0(no data activity). That call was received by opposite
person and even it is speaking something but there is no invokation of
onDataActivity other time. What could be wrong in it ? I hope some one
can suggest me some thing.

Let me know if i am missing any thing.


Hope some quick reply
--~--~---------~--~----~------------~-------~--~----~
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