addProximityAlert method in LocationManager

by newbie11 » Mon, 12 May 2008 17:04:46 GMT

Sponsored Links
 I have a question about the addProximityAlert method in

If one invokes the method does it later send the intents on an
INTERRUPT basis (e.g. when it enters the proximity radius) OR does it
POLL at specific intervals to see if the device is in the radius. E.g.
is it interrupt or poll based.

If it is poll based what is the interval.  Furthermore (it is not
clear in the documentation but is in fact the polling interval being
set for addProximityAlert by requestUpdates. If this is the case it
should NOT be possible to invoke addProximityAlert without invoking
requestUpdates first. However, the documentation does not seem to
suggest any such constraint).

Another important question is about the device being turned OFF. How
does one make sure the previous invocation of addProximityAlert (e.g.
before the power down) is remembered basically forever (e.g. until the
user explicitly says otherwise).

addProximityAlert method in LocationManager

by Megha Joshi » Mon, 12 May 2008 21:24:13 GMT


When you use addProximityAlert(), the location manager service sends a
message to check if the device is in proximity of the given location. This
message is sent, after traveling a specific amount of distance every time,
until the the required proximity alert is fired.

requestUpdates() does not need to be called before addProximityAlert(), they
are both used independently.

You can use the getLastKnownLocation() method of LocationManager for this: #getLastKnownLocation(java.lang.String)



Sponsored Links

addProximityAlert method in LocationManager

by newbie11 » Mon, 12 May 2008 21:51:30 GMT

 Thank you Megha for taking the time to answer.

What is the "specific amount of distance every time"? You seem to be
suggesting a type of polling based on distance moved.  How is this
specific distance set? Where is it documented?

It is true that the last known location can be queried even if the
device has been turned off in the interim ... perhaps this is why you
mentioned it since I mentioned the device been powered down.  Perhaps
I did not explain myself well.  This is not the question I asked.
Allow me to try again.  Will the ADDPROXIMITYALERT still be valid
after a power down? I am not interested in the last position. I just
want to know how to have a proximity alert forever even after a power
down event unless the user specifies otherwise. How is this

addProximityAlert method in LocationManager

by Megha Joshi » Mon, 12 May 2008 22:38:16 GMT


Yes it is polling based on distance travel. These are implementation
details, so they do not need to be documented.

There is no API to do that, however you can make a Service which runs on
device reboot and sets all the ProximityAlerts again.


addProximityAlert method in LocationManager

by hackbod » Tue, 13 May 2008 07:06:10 GMT


Actually a receiver. :)


addProximityAlert method in LocationManager

by [EMAIL PROTECTED] » Tue, 13 May 2008 12:10:26 GMT


Thanks for addressing this topic.  We need to know, or be able to set
as a parameter, the step resolution of the proximity tool.

This has implications for finding lost children at crowded events
where they can be invisibly short.

If it is device dependant and not accessible for change, i.e. too far
down in the code structure, is there a hardware person we can ask?

Thanks for any direction on getting an answer on this one.



addProximityAlert method in LocationManager

by Mark Murphy » Tue, 13 May 2008 12:30:33 GMT


Not all location services will have equal granularity in terms of 
position changes, simply because not all location services have equal 
accuracy. GPS is only accurate to ~15m, and cell tower triangulation 
might well be worse. And the characteristics of future services (WiFi 
triangulation, Galileo, etc.) will vary as well. You can't, for example, 
expect a device to send out position updates every 2cm if position 
resolution is on the order of ~15m.

Maybe Android could offer another filter criterion so your application 
can find a location provider that offers the level of service you're 
seeking, if such a provider is available on the specific device.

Mark Murphy (a Commons Guy) 
The Busy Coder's Guide to Android Development -- coming in June 2008!


addProximityAlert method in LocationManager

by newbie11 » Tue, 13 May 2008 15:43:10 GMT

 Thanks Megha for your reply. Have another question for you.

Following up one more important question.  How does one ensure that
whatever addProximityAlert uses to work is FREE. For example, ideally
use the free gps chip in the device to see if the radius has been
entered rather than something that will cost the user money.

P.S. The documentation does not seem to REQUIRE a provider selection
to use addProximityAlert, so the two don't seem to be connected.

addProximityAlert method in LocationManager

by [EMAIL PROTECTED] » Tue, 13 May 2008 16:57:34 GMT


Thank you for the orienting information.  If I understand correctly 15
m is an absolute accuracy.  This application of finding a child does
not need to run in the background efficiently and absolute coordinates
are not needed.  A garmin running GPS can resolve which side of a
sidewalk you are on. Like 6 feet. But this is a differential signal.

Active polling and looking at the differential GPS information will
deliver what we need. A second step may be sending the raw tower based
location data to the parent phone for comparing with that raw tower
based location data, (do the difference pre rounding) but that would
be a market expansion on software that already works when GPS is

Thanks for helping a decision to just use code we control for this.


addProximityAlert method in LocationManager

by zero » Wed, 14 May 2008 21:04:12 GMT


you could use the alert framework for that.
any registered alerts will be activated again on boot/ power up.
feel free to contact me / post on our mailing list for any
questions/ needed improvements about alert framework. :)

Other Threads

1. Alternatives for selling apps from non eligible countries

Basically that's my question. I know it's not possible in the market right
now, but is there another way? like using a publisher.

Are those alternative markets doing well? Andappstore and

Thanks, I would really like to sell an application and this is kinda

I'm in Canada btw.

Ivan Soto Fernandez
Web Developer


2. eclipse plugin repository not available

following directions at

I cannot install the eclipse plugin at
https doesn't work either

eclipse gives the following error:

No repository found at
  Error reading update site
  Connection refused


3. Sensors: file descriptor closed

4. What is "active installs"? ... any why does it jump?

5. Rotate (90, 180, 270) Camera Preview by SurfaceFlinger ?

6. How to HTTP Post

7. Could title bar of activity listen to click event?