2

保留中のインテントでいくつかの問題に直面しています。NotificationManagerを使用していくつかの保留中のインテントを設定しました。これらの通知は、ユーザーがクリックするとアクティビティを開始します。保留中のインテントで使用されるインテントを使用して、いくつかのエクストラを配置しました。これは、通知クリックで問題なく機能します。

Notification notification = new Notification(icon, tickerText, when);
    Context context = getApplicationContext();

Intent intentOptionDialog = new Intent(Safety_Check_Service.this, Dialog_Safety_Check.class);
    intentOptionDialog.putExtra("startID",startId);
    intentOptionDialog.putExtra("CheckInID", CheckInId);
    intentOptionDialog.putExtra("Frequency", Frequency);
    intentOptionDialog.putExtra("flagFirstShedule", true);

        stopID = (startId + 17);

    intentOptionDialog.putExtra("stopID", stopID);

    PendingIntent contentIntent = PendingIntent.getActivity(Safety_Check_Service.this, DIALOG_ID, intentOptionDialog, 0);

しかし、私の問題は、これらの保留中のインテントを別のアクティビティから起動したいということです。保留中のインテントが作成されます。これらの保留中のインテントを別のアクティビティからどのように引き出すことができますか?また、保留中のインテントで設定されたエクストラを取得するにはどうすればよいですか?

私を助けてください。

4

2 に答える 2

5

ここに2つのピースがあると思います:

  1. Keeping track of sms sent in Android で私が提供した回答を使用してみてくださいFILL_IN_SELECTOR。作成時にフラグを追加してPendingActivity、エクストラを一緒に運ぶように強制します。
  2. を取得したらPendingIntent、メソッドを呼び出すだけでそれを起動できますsend
于 2012-04-18T06:08:32.030 に答える