デバイスが固定ゾーンに入ったときにアクティビティを表示したい。recivier(GpsAlarmRecivier) に startActivity があります。以下のコードは機能しますが、Activity を閉じるとクラッシュします。受信者の登録を解除する必要があるためです。
しかし、アクティビティを閉じた後でも、すべてのアプリケーションにaddProximityAlartを使用したい(たとえば、前に移動する)。出来ますか ?
Intent myIntent = new Intent("gpsup.namespace.ProximityAlert");
PendingIntent proximityIntent = PendingIntent.getBroadcast(cxt, 0, myIntent, 0);
locationManager.addProximityAlert(records.get(pos).x, records.get(pos).y, records.get(pos).r,
-1, proximityIntent);
IntentFilter filter = new IntentFilter("gpsup.namespace.ProximityAlert");
actv.getApplicationContext().registerReceiver(new GpsAlarmReceiver(), filter);
受信者を作成したときに、アクティビティを閉じてもaddProximityAlertを使用したい。アドバイスをありがとう。