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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:12:47+00:00 2026-06-16T15:12:47+00:00

I am wondering what happens when you create a broadcast reciever from within your

  • 0

I am wondering what happens when you create a broadcast reciever from within your main activity (in my case a proximity alert receiver), and the app process is killed for some unknown reason?

I want my proximity alerts to be received in the broadcast recevier i register, regardless of my app state, will that happen or do i need to do something in particular to ensure that?

EDIT to clarify:

I have to register the receiver from within my app rather than via the manifest. Since i want multiple proximityalerts, for each (varying) location i will need to create the receivers dynamically, since i need to register the receiver for each location, with a unique id, unfortunately.

code to create my intent/pendingintent/broadcastreceiver:

    double latitude = location.getLat();
    double longitude = location.getLon();
    Intent intent = new Intent(PROX_ALERT_INTENT_ID);
    PendingIntent proximityIntent = PendingIntent.getBroadcast(activity.getApplicationContext(), 0, intent, 0);
    lm.addProximityAlert(
        latitude, // the latitude of the central point of the alert region
        longitude, // the longitude of the central point of the alert region
        POINT_RADIUS, // the radius of the central point of the alert region, in meters
        PROX_ALERT_EXPIRATION, // time for this proximity alert, in milliseconds, or -1 to indicate no                           expiration
        proximityIntent // will be used to generate an Intent to fire when entry to or exit from the alert region is detected
    );

    IntentFilter filter = new IntentFilter(PROX_ALERT_INTENT_ID);

    activity.registerReceiver(new ProximityIntentReceiver(location), filter);
  • 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-16T15:12:49+00:00Added an answer on June 16, 2026 at 3:12 pm

    If you want to have your BroadcastReceivers triggered regardless of your apps state then you should register them through your applications AndroidManifest.xml file.

    Heres how to do it.

    1. Define a class that extends BroadcastReceiver and implement the onReceive() method.
      I see that you have already done that – ProximityIntentReceiver is that class.

    2. In your AndroidManifest.xml file add:

      <application>
      ...
          <receiver
              android:name=".MyReceiver"
              android:exported="false" >
              <intent-filter>
                     <action android:name="my.app.ACTION" />
              </intent-filter>
          </receiver> 
      </application>
      

    Where MyReceiver is the name of your receiver class (ProximityIntentReceiver in your case) and my.app.ACTION is the action that your receiver will listen for (in your case I’m guessing it’s the value of PROX_ALERT_INTENT_ID).

    Note: Saying that the name of your receiver is .MyReceiver assumes that it’s located in the root package of your app. If that is not the case then you need to provide the path to that class starting from the root.

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

Sidebar

Related Questions

I am wondering what Error = Invalid argument from qbuf means. This happens when
I'm wondering what happens when I use a MKReverseGeocoderDelegate in my ViewController, but the
I'm wondering what happens after the constructor is done executing my code, because the
I'm going through the django tutorials and I was wondering what happens when you
I was wondering if anyone happens to know of a jQuery (or pure javascript)
I was wondering if there was any resources available online that explains what happens
I'm just playing around with some PHP and was wondering what happens when an
I've been thinking about the web app I'm about to begin developing and wondering
Regarding setting up script maps on IIS, I am wondering what happens if I
Just wondering, if I statically create an object that has a pointer as a

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.