I think I'm doing everything right wrt ProximityAlerts but I only get
notified in about 1 in a 100 times.
When I switch to Map Mode in my app, I gt a list of locations, map them and
send each one as a ProximityAlert via this code:
Intent intent = new Intent(TYW_PROXIMITY_ALERT);
PendingIntent proximityIntent =
PendingIntent.getBroadcast(MainMap.this, 1000, intent, 0) ;
myLocationManager.addProximityAlert(dLat, dLong,
proximityRadius, 100000000, proximityIntent);
Log.i(TAG, "Added ProximityIntent for" + ""+dLat +","+
""+dLong);
I have an IntentReceiver setup like this:
public class ProximityIntentReceiver extends BroadcastReceiver {
@Override
public void onReceive (Context context, Intent intent) {
String intentAction = intent.getAction();
Toast.makeText(MainMap.this,
intentAction.toString(),
Toast.LENGTH_SHORT).show();
// stuff about Vibrators and Notifications elided
}
}
I set up an IntentFilter programmatically:
private void setIntentFilters() {
IntentFilter proxFilter = new IntentFilter(TYW_PROXIMITY_ALERT);
registerReceiver(new ProximityIntentReceiver(), proxFilter);
}
which I call in onCreate().
I've set the minimum distance/time to check for updates to be ridiculously
low (10 feet, 5 secs, 0 for each, etc.).
I assumed I didn't actually have to move to see a ProximityAlert fired but
maybe I do, so today I set up three PAs and walked right past the
locations. The GPS followed right along but I never got a Notification.
What's the magic to get it to work? Or does it work in some manner I don't
yet grok?
--
Faber Fedor
Linux New Jersey
http://linuxnj.com
faberfedor.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---