Hi All,

While debugging the code below, BroadcastReceiverCustom is being
called but PhoneStateListenerCustom is not. Please help.

For now I and doing required action in BroadcastReceiverCustom only,
but maynot be best place to do it.
Any suggestions why PhoneStateListener not being called??
Already spent lot of time for possible reasons, no idea??
Manifest file is all correct with correct permissions.
I see no runtime exceptions.
Please help.

BroadcastReceiverCustom.java

public class BroadcastReceiverCustom extends BroadcastReceiver {

private static final String TAG = "BroadcastReceiverCustom";

        @Override
        public void onReceive(Context context, Intent intent) {

                Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!");

                TelephonyManager telephony =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
            PhoneStateListenerCustom phoneStateListenerCustom = new
PhoneStateListenerCustom();
            telephony.listen(phoneStateListenerCustom,
PhoneStateListener.LISTEN_CALL_STATE);
        }
}

PhoneStateListenerCustom.java

public class PhoneStateListenerCustom extends PhoneStateListener {

private static final String TAG = "PhoneStateListenerCustom";

public void onCallStateChange(int state, String incomingNumber){

                        Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!");
                switch(state){
                        case TelephonyManager.CALL_STATE_RINGING:
                                Log.d(TAG, "RINGING");
                                break;
                }

                        super.onCallStateChanged(state, incomingNumber);

        }
}


Manifest file

      <uses-permission
android:name="android.permission.READ_PHONE_STATE" />


        <receiver android:name=".BroadcastReceiverCustom">
                <intent-filter>
                        <action
android:name="android.intent.action.PHONE_STATE" />
                </intent-filter>
                </receiver>

-- 
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

Reply via email to