私のアプリでは、ある時点で次のような近接アラートを作成します。
m_LocationManager.addProximityAlert(lat, lon, radius, PROXMITY_ALERT_EXPIRATION_TIME, m_PendingIntent);
ある時点で、アプリのプロセスが Android によって終了された場合、次の 2 つのメソッドを実装します。
public void onSaveInstanceState(Bundle savedInstanceState)
public void onRestoreInstanceState(Bundle savedInstanceState)
しかし、私のアラートは発生しません..、アラートを作成するコードをサービスに移動する必要があると思います。
これは、アラートを設定するためのコードです。
IntentFilter intentFilter = new IntentFilter("PROX_ALERT_INTENT");
m_NotificationAlertReciever_BroadcastReciever = new NotificationAlertReciever_BroadcastReciever(m_myLocationListener, this);
registerReceiver(m_NotificationAlertReciever_BroadcastReciever, intentFilter);
Intent intent = new Intent("PROX_ALERT_INTENT");
intent.putExtra("lat", lat);
intent.putExtra("lng", lon);
intent.putExtra("place", place);
m_PendingIntent = PendingIntent.getBroadcast(this, -1, intent, PendingIntent.FLAG_CANCEL_CURRENT);
this.m_LocationManager.addProximityAlert(lat, lon, radius, PROXMITY_ALERT_EXPIRATION_TIME, m_PendingIntent);
誰かがそれを承認するか、他のアドバイスを与えることができます.
前もってありがとう、Amitos80