Trouble sending Bundle with PendingIntent to a Broadcast Receiver, data lost

后端 未结 1 1030
孤独总比滥情好
孤独总比滥情好 2020-12-31 07:53

I am adding some basic alarm functionality to my program via the use of AlarmManager and a BroadcastReceiver class (named AReceiver.java). My problem is that the data I add

相关标签:
1条回答
  • 2020-12-31 08:49

    You have to change this line

    PendingIntent alarmIntent = PendingIntent.getBroadcast(this, pendingPeriodIntentId, intent, 0);
    

    into this

    PendingIntent alarmIntent = PendingIntent.getBroadcast(this, pendingPeriodIntentId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    

    otherwise the data is lost

    0 讨论(0)
提交回复
热议问题