AddProximityAlert disappears even though expiration is -1
I want my app to have a proximityAlert until the user deletes it. I am using expiration -1 to create this proximityAlert. Proximity Alert works. But I find myself on my Droid phone after adding proximityAlert and leaving the phone overnight to charge, proximityAlert does not work the next day. How can I make sure my proximityAlert is active indefinitely if the user doesn't delete it?
a source to share
The proximity alert uses a long variable to expire. Are you putting the number -1 in the neighborhood of Alert or a variable declared so long that it is -1? Perhaps using a long variable instead of -1 will fix it.
addProximityAlert (double latitude, double longitude, float radius, long-term survival , PendingIntent intent)
a source to share
LocationManager uses HashMap<PendingIntent,ProximityAlert>
to store its alerts.
See the code here .
1) ProximityAlert uses your provided PendingIntent as a key if you add 2 ProximityAlerts for two coordinates, but with the same PendingIntent, then only the last proximity alert will work.
2) removeProximityAlert(PendingIntent pIntent)
should be used to remove the alert.
a source to share