Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4055512
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:42:37+00:00 2026-05-20T14:42:37+00:00

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

  • 0

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

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.

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:42:38+00:00Added an answer on May 20, 2026 at 2:42 pm

    you should not instantiate the TelephonyManager and PhoneStateListener in the BroadcastReceiver. here is some example code:

    in Activity:

    EndCallListener callListener = new EndCallListener;
    TelephonyManager mTM = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
    mTM.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE);
    
    private class EndCallListener extends PhoneStateListener {
        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
            if(TelephonyManager.CALL_STATE_RINGING == state) {
                Log.i(LOG_TAG + "Listener", "RINGING, number: " + incomingNumber);
            }
            if(TelephonyManager.CALL_STATE_OFFHOOK == state) {
                Log.i(LOG_TAG + "Listener", "OFFHOOK, number: " + incomingNumber);
            }
            if(TelephonyManager.CALL_STATE_IDLE == state) {
                Log.i(LOG_TAG + "Listener", "IDLE, number: " + incomingNumber);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While debugging and keep pressing F5, if the source code does not exist, eclipse
While debugging some code I got something like below: #include<stdio.h> int main() { FILE
While debugging some C code with gdb I came across something I've not seen
i get this dialog while debugging code in visual studio 2008. (your step-into request
I have some debugging code that if executed while running with GBD attached should
I'm using below code to file copy operataion in windows seven,but it doesn't work
I'm developing a code in Eclipse (java). While debugging the code, I used a
I need some advice on debugging the code below please. I'm feeding in Twitter
Hey everyone, I am having a little trouble debugging my code. Please look below:
I am using the code snippet below, however it's not working quite as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.