私は Parse プッシュ通知を使用しており、これらのメソッドを使用して、メッセージの内容をユーザーに警告しています。AlertDialog を一度表示し、その後そのデータをインテントから削除して、アプリが強制終了されたのではなく単に一時停止された場合に再度ポップアップしないようにするにはどうすればよいですか?
onCreate() の最後に
handlePushIntent(getIntent());
onNewIntent() をオーバーライドしました
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
handlePushIntent(intent);
}
そして私の方法:
private void handlePushIntent(Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null || extras.isEmpty())
return;
if (extras.containsKey("com.parse.Data")) {
try {
JSONObject data = new JSONObject(extras.get("com.parse.Data")
.toString());
String alert = data.getString("alert");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(alert);
builder.setNeutralButton(android.R.string.ok, null);
builder.show();
} catch (Exception e) {
Log.d("VNL", "Push Error", e);
}
}
}