getIntent() Extras always NULL

前端 未结 5 2258
南方客
南方客 2020-11-27 03:19

I wrote a simple Android App that show a custom Notification like this:

Context context = getApplicationContext();          
NotificationManager manager = (N         


        
5条回答
  •  一个人的身影
    2020-11-27 04:09

    Problem: You are sending the same request code for your pending intens. Change this.

    Solution: Set global variable int UNIQUE_INT_PER_CALL =0 and when you create pendingIntent call like below.

    PendingIntent contentIntent = PendingIntent.getActivity(context, UNIQUE_INT_PER_CALL, notificationIntent, 0);
    UNIQUE_INT_PER_CALL++; // to increment.
    

提交回复
热议问题