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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:45:15+00:00 2026-06-08T09:45:15+00:00

I work on an Android app, what should simply post some information about the

  • 0

I work on an Android app, what should simply post some information about the battery in the notification-bar. I started this project like all the tutorials advised:

  • I created a BroadcastReceiver. It handles the UI stuff.
  • Then i created an IntentFilter, what filters only the
    ACTION_BATTERY_CHANGED intents
  • Then i simply registered the IntentFilter and the BroadcastReceiver instances
    with the registerReceiver() method of my main Activity.

It works really fine, until the Activity (what registered the two) stops. By stoping i mean, i press the back button on the phone, and i assume the onStop() or/and onDestroy() methods get called.

My question is, how could i get the BroadcastReceiver to run after the Activity is finished, and only stop recieving, when i ‘Force close’ the app?

UPDATE:

Okay, from the previous answers i think, what i need to do, is start my BroadcastReciever from the manifest file, and not from the Activity. This is what i tried to do, but it simply doesn’t start recieving:

<receiver android:name="com.battery.indicator.BatteryReciever" android:enabled="true" >
    <intent-filter>
        <action android:name="android.intent.action.BATTERY_CHANGED" ></action>
    </intent-filter> 
</receiver>

The name attribute is the whole package-path to my Reciever class.
The actions name is what Eclipse’s intellisense found. All of this is in the <application></application> part of the xml.

What am I doing wrong?

  • 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-06-08T09:45:17+00:00Added an answer on June 8, 2026 at 9:45 am

    Create service and register your receiver in the Manifest. Then Android will wake up and call your receiver even if your app is currently closed.

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

Sidebar

Related Questions

I have 1 android app project and 1 widget project, they all work fine.
This is my first post, and I've only recently started programming for Android and
I have a simple understanding of how this sample app should work. I have
how to make android 2.2 app work in android 4 ? Is it a
I'm porting a web-app from iPhone to Android. Unexpectedly, buttons work as usual, except
I do some android work on my desktop and I am starting to do
How does the Export feature of Eclipse work in Android Project. Does it totally
It should work similar to the android home screen. Which way has the best
I'm writing an Android app for work that shows the status of our phone
I created an Android app widget that displays some text. By pressing on the

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.