LoginSignup
7
6

More than 5 years have passed since last update.

【Android】Push通知タップ後にActivityが起動しない場合の対処法

Posted at

概要

同じアプリ内で複数のPendingIntentを使っている(NotificationやWidgetを実装している)場合に、Push通知タップ後にActivityが起動しないときの対処法メモです。

結論

PendingIntent.getActivity()の第二引数をユニークな値にする。

以下のように第二引数を固定値にしているとActivityが起動しない場合があります。

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

その場合は以下のようにユニークな値に変更すると解決します。

PendingIntent pendingIntent = PendingIntent.getActivity(context, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT);

参考

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6