0

ユーザーが通知をクリックしたときにパラメータを送信する必要があります。

通知を作成するためのマイコード:

        NotificationManager notifManager = (NotificationManager) c.getSystemService(c.NOTIFICATION_SERVICE);
        Notification note = new Notification(R.drawable.ic_launcher, "Smartdrifter", System.currentTimeMillis());  

        Intent WA = new Intent(c, WebActivity.class);

        WA.putExtra("url", urlTarget);
        WA.putExtra("valid", notifId);
        WA.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent intent = PendingIntent.getActivity(c, 0, WA, 0);

        notifManager.cancel(notifId);
        note.setLatestEventInfo(c, titulo, texto, teste());  

        notifManager.notify(notifId, note);

リクエストパラメータのマイコード:

String url = getIntent().getStringExtra("url");

しかし、応答はNULLです。

リクエストパラメータには別の形式がありますか?

ありがとう。

4

1 に答える 1

2

組み込みのメソッドを使用onNewIntent(Intent intent)します。アクティビティWebActivityで保留中のインテントをキャッチします。

@Override
public void onNewIntent(Intent intent) {

    setIntent(intent);
    String url = getIntent().getStringExtra("url");

}
于 2013-03-25T10:44:01.353 に答える