Notification with “null” PendingIntent

后端 未结 2 1905
长情又很酷
长情又很酷 2021-02-04 01:44

I\'m trying to implement notification in Android.

Now I have a problem, I don\'t want to have a PendingIntent that user will open any Activity.

相关标签:
2条回答
  • 2021-02-04 02:26

    The following works and seems more straightforward:

    PendingIntent pi = PendingIntent.getActivity(context, 0, null, 0);
    

    Having a notification without launching a subsequent Activity seems quite sensible to me - eg "Its time to get up!.

    0 讨论(0)
  • 2021-02-04 02:39
    PendingIntent contentIntent = PendingIntent.getActivity(
        getApplicationContext(),
        0,
        new Intent(), // add this
        PendingIntent.FLAG_UPDATE_CURRENT);
    
    0 讨论(0)
提交回复
热议问题