开发者

When you get response from an addProximityAlert how do you know for which setup you got it?

开发者 https://www.devze.com 2023-01-05 08:30 出处:网络
I add to system a lot of POIs via addProximityAlert. When I have got the alert, I don\'t know for which setting has occurred.

I add to system a lot of POIs via addProximityAlert. When I have got the alert, I don't know for which setting has occurred.

The only Extra that is passes is the 'entering' flag as it is described in the documentation.

How can I know that?

After the answers here is the working code:

Intent intent = new开发者_如何学Python Intent(this, PlacesProximityHandlerService.class);
intent.setAction("PlacesProximityHandlerService");
intent.putExtra("lat", objPlace.getLat());
intent.putExtra("lon", objPlace.getLon());
intent.putExtra("error_m", objPlace.getError()+ALERT_RANGE_IN_METERS);
PendingIntent sender=PendingIntent.getService(this, 0, intent, 0);
LocationUtils.addProximity(this, objPlace.getLat(), objPlace.getLon(),objPlace.getError()+ALERT_RANGE_IN_METERS, -1, sender);


Use a custom action string on your Intents that you wrap in the PendingIntents, so you can tell the different ones apart, for example.

0

精彩评论

暂无评论...
验证码 换一张
取 消