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 3444052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:52:02+00:00 2026-05-18T08:52:02+00:00

Is there any sample application which demonstrates the capabilities of Telephony API of android?

  • 0

Is there any sample application which demonstrates the capabilities of Telephony API of android? I am interested in getting the call notifications / caller number etc(I understand its doable with PhoneStateListener). Also, Is it possible for 3rd party application to change the incoming call window / outgoing call window (basically to give the user an extra button to search the incoming number from a REST service) ?

Any useful links or sample application would be very much helpful. Any suggestions ?

  • 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-18T08:52:02+00:00Added an answer on May 18, 2026 at 8:52 am

    PhoneStateListener tells your app about phone activity. Here’s some sample code from one of my apps that pauses music when the phone is active:

    /**
     * Helper class to pause music while a phone call is in progress.
     * 
     * The Android emulator can simulate an outgoing call by clicking
     * the phone button and dialing normally.  Simulate an incoming call
     * by starting the emulator, "telnet localhost 5554" then enter 
     * "gsm call 5551234" into the telnet session.  
     */
    private class MusicServicePhoneStateListener extends PhoneStateListener {
        private boolean mResumeAfterCall = false;
    
        @Override
        public void onCallStateChanged(int state, String incoming_number) {
            switch (state) {
            case TelephonyManager.CALL_STATE_OFFHOOK:
            case TelephonyManager.CALL_STATE_RINGING:
                Log.i(tag, "phone active, suspending music service");
                mResumeAfterCall = mMediaPlayer.isPlaying();
                mMediaPlayer.pause();
                break;
            case TelephonyManager.CALL_STATE_IDLE:
                Log.i(tag, "phone inactive, resuming music service");
                if (mResumeAfterCall) {
                    mMediaPlayer.start();
                }
                break;
            default:
                break;
            }
        }
    }
    

    Create and start the listener in onCreate via:

        mPhoneListener = new MusicServicePhoneStateListener();
        ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE)).listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
    

    Stop the listener in onDestroy with:

        ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE)).listen(mPhoneListener, 0);
    

    As for modifying the incoming call dialog the best suggestion I’ve found is to use a short delay followed by a custom toast message (delay so that your toast appears “above” the incoming call dialog).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any good sample UI applications which illustrate multi threading best practices in
Are there any sample applications avaliable that make use of both caliburn and prism?
Is there any utility (or sample source code) that truncates HTML (for preview) in
Is there any (simple) way to get some control of the order in which
Is there any reference about writing an application on iPad/iPhone to show HTML5 content
I have an application which needs to be able to write to Any User/Current
I am trying a sample application in which I have taken following controls: i.
I am new to Android development and want to build a first sample application.
I am implementing the client side of some java application for Android devices which
I have a little paint application which was based on the GLPaint sample code.

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.