私のアプリでは、アクティビティ(AndroidNotification.java)で次のことを行っています:
1) ユーザーがホームボタンを押したときに通知を表示しています。
2) ユーザーが通知をクリックすると、アプリにアクティビティが表示されます - AndroidNotification.java
3)アプリが前面に出たときに通知バーの通知を閉じます(つまり、onResumeメソッドにあります)
以下のコードは機能していますが、問題は通知がアクティビティ(AndroidNotification.java)を再度呼び出すことです
私の質問は、アクティビティを再開したくないということです。通知は
バックグラウンドからフロントへのアクティビティは、再起動を呼び出すべきではありません。
現在の動作の結果、アクティビティが再度呼び出されるため、機能全体が再び機能します。それが問題だ 。
私のコード:
private NotificationManager mNotificationManager;
Notification notifyDetails;
......
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notifyDetails = new Notification(R.drawable.ic_launcher,
"Notification, Click Me!", System.currentTimeMillis());
Context context = AndroidNotification.this;
CharSequence contentTitle = "Notification Test";
CharSequence contentText = "Get back to Application on clicking me.";
Intent notifyIntent = new Intent(context, AndroidNotification.class);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT );
PendingIntent intent = PendingIntent.getActivity(
AndroidNotification.this, 0, notifyIntent,0);
// Set properties to notify object - its title, text
notifyDetails.setLatestEventInfo(context, contentTitle,contentText, intent);
// Notify user in status bar
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
AndroidManifest.xml の特定のアクティビティに追加する必要があるものは何か
私を助けてください。