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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:29:37+00:00 2026-05-20T01:29:37+00:00

Possible Duplicate: Android: how to cancel a request of Location update with intent? I

  • 0

Possible Duplicate:
Android: how to cancel a request of Location update with intent?

I am trying to disable a pending intent(broadcast) which I have previously created in a different activity but I can’t get it to work. I’ve read that I should recreate the intent(with the same extras and everything), pass it as a parameter so that I can instantiate the pendingIntent and then pass the pendingIntent as a parameter to the location managers removeUpdates method.

In other words:


Bundle extra = new Bundle();

extra.putString("name", extras.getString("poiName")); //create same extras

extra.putInt("id", extras.getInt("rowId")); //create same extras

Intent intent = new Intent(PROX_ALERT_INTENT);  

intent.putExtra(PROX_ALERT_INTENT, extra);  //put same extras in the intent

PendingIntent proximityIntent = PendingIntent.getBroadcast(this.getApplicationContext(),extras.getInt("rowId") , intent, PendingIntent.FLAG_UPDATE_CURRENT);  //pass in the intent

LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
                                               locationManager.removeUpdates(proximityIntent);  //remove pendingIntent

That didn’t work so I thought that it might have to do with the intent that im passing in being a new object and not the same with the one used in order to create the pending intent.

So I tried removing the pendingIntent right after I create it but that didnt work either:

Bundle extras = new Bundle();

    extras.putString("name", poiName);

    extras.putInt("id", requestCode);

    Intent intent = new Intent(PROX_ALERT_INTENT);

    intent.putExtra(PROX_ALERT_INTENT, extras);

    PendingIntent proximityIntent = PendingIntent.getBroadcast(this.getApplicationContext(), requestCode , intent, PendingIntent.FLAG_CANCEL_CURRENT);

    locationManager.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
   );
    locationManager.removeUpdates(proximityIntent);

Can you please help me with that??? Its been bugging be since wednesday…wish i had more reputation to put a boundy on this one…

Thanks

mike

  • 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-20T01:29:37+00:00Added an answer on May 20, 2026 at 1:29 am

    Resolved it by recreating the intent and then calling .cancel() on the pending intent…

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

Sidebar

Related Questions

Possible Duplicate: Developing for Android in Eclipse: R.java not generating I have imported a
Possible Duplicate: Android Emulator - Trouble creating user accounts I'm trying to register a
Possible Duplicate: Retrieving Android API version programmatically I am trying to retrieve the current
Possible Duplicate: Android - iphone style tabhost I am trying to figure out how
Possible Duplicate: Android: Clickable hyperlinks in AlertDialog Hi, I have created an AlertDialog with
Possible Duplicate: Listview inside ScrollView is not scrolling on Android I have a ListView
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: Android: How to resize a custom view programmatically? What's the best way
Possible Duplicate: Android - shadow on text? How can i make shadow effect text

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.