intent.putExtra() in pending intent not working

后端 未结 5 720
你的背包
你的背包 2021-02-02 08:25

I am passing a pending intent through alarmreceiver, from a service class. But, after the pendingIntent fires, the intent.putExtra() information is not being received by the bro

5条回答
  •  情话喂你
    2021-02-02 08:43

    Remember to put an unique id in the PendingIntent constructor, or you could get some weird thing when you try to get the putExtra values.

        PendingIntent pendingIntent = PendingIntent.getBroadcast(
               getApplicationContext(), 
               UUID.randomUUID().hashCode(), 
               aint, 
               PendingIntent.FLAG_UPDATE_CURRENT
        );
    

提交回复
热议问题