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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:30:50+00:00 2026-05-27T01:30:50+00:00

I am doing an android application. In my project I am checking phonestates using

  • 0

I am doing an android application. In my project I am checking phonestates using broadcast receiver.Using the folowing code I am checking my phonestate.

@Override
public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    Bundle bun=intent.getExtras();
    if(bun!=null){
        String state=bun.getString(TelephonyManager.EXTRA_STATE);
        Log.w("DEBUG", state);
        if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
            String phoneno=bun.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
            Toast.makeText(context, "phone no. is"+phoneno, Toast.LENGTH_LONG).show();
        }
    }
}

Now i want control this application from activity. I mean using an button i have start the broadcast and using an off button i have to close the broadcast run.the second problem is i want run the application when the application is in closed state too. So i think I have call a service from activity and that service make that broadcast receiver to run in the background. And if i want to stop my application’s processing open app and click the button to off. Help me friends..

  • 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-27T01:30:51+00:00Added an answer on May 27, 2026 at 1:30 am

    You can ,

    When click on
    Registered your broadcast

        IntentFilter filter=new IntentFilter(TelephonyManager.EXTRA_STATE);
        registerReceiver(new BroadcastReceiverClass.class, filter);
    

    when click off
    unregistered your broadcast

     unregisterReceiver(new BroadcastReceiverClass());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we are doing an android chat application in 2.3.3 as a project in final
I'm doing project on android chat application with both friends and anonymous. we finished
I'm doing a Get and Post method for an android project and I need
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I am developing an Android application, I was doing just fine then I made
I'm kind of a noob in the android world, and doing a pet project
I am doing a small android application, which will show established WiFi connection is
i am doing a project in android. i am a begineer in android also.
I'm creating an android application I wish to release commercially. Before doing so I
My Android application is expecting and array of usernames from my WCF Service using

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.