2

addProximityAlertを介してシステムに多くのPOIを追加します。アラートを受け取ったとき、どの設定が発生したのかわかりません。

渡される唯一のExtraは、ドキュメントに記載されている「entering」フラグです。

どうすればそれを知ることができますか?

ここでの答えの後には、動作するコードがあります。

Intent intent = new 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);
4

1 に答える 1

1

Intentsでラップするカスタムアクション文字列をsに使用しPendingIntentて、たとえば、異なるものを区別できるようにします。

于 2010-06-27T17:59:41.723 に答える