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

  • Home
  • SEARCH
  • 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 7639067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:19:30+00:00 2026-05-31T08:19:30+00:00

I originally registered my broadcast receiver in my main Activity via code. However, I

  • 0

I originally registered my broadcast receiver in my main Activity via code. However, I have IntentServices (that run in the background) which broadcast intents and as such, need the Broadcast Receivers to always be available. My method of registering the receivers in my code worked ok until the back button was pressed. Then, the receivers would be deregistered as the main activity would be destroyed.

As such, I had the idea to move the declaration of the receivers to the Manifest file. However, I am coming across a strange problem where everytime my code broadcasts an intent, a new instance of the broadcast receiver is created. What I want, is for a single instance of a broadcast receiver to be available at all times. This is due to the fact that my broadcast receiver creates and starts a timer, however if multiple instances of the receivers are created, then multiple timers are created which is not good.

Note: A single instance of my broadcast receiver can handle the case where it receives an intent but the timer is already started.

Here is my code in the Manifest file:

<receiver android:name=".StartTimerBroadcastReceiver" android:enabled="true" >
        <intent-filter>
            <action  android:name="START_TIMER" />
        </intent-filter>
</receiver>

And here is my code that broadcast intents:

Intent broadcastIntent = new Intent("START_TIMER");
broadcastIntent.putExtra("timerID", "timer1");
sendBroadcast(broadcastIntent);

Am I doing something wrong? Any help is appreciated. Thanks

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

    Its not possible to have one instance of BroadcastReceiver through Manifest.

    What you can do is create a Static variable for your Timer.

    If that is not the solution for your problem then create a Service and when a broadcast is received start the Service with some EXTRA in Intent specifying how to start the Time.(i.e just redirect the broadcast to your service).

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

Sidebar

Related Questions

I have a broadcast receiver registered programatically in a activity. It responds to the
I have a .xll plugin that registered a few functions which we use in
I have a live Django site that already has registered users. I am trying
I've been refactoring some code that was originally using the Messenger in MVVM Foundation
Edit: original question below, but I revise it now that I have some code
I've got a registered ActiveX component which I'm referencing in a C# project. However,
Originally there was the DAL object which my BO's called for info and then
Originally, I just want to verify that session_start locks on session. So, I create
I originally asked this question , but in finding an answer, discovered that my
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost

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.