Sending Extras to onReceive only retrieves ALARM_COUNT

笑着哭i 提交于 2021-02-10 07:03:19

问题


I made a custom view that sets an alarm with AlarmManager. I want to restore this view later so I'm trying to send the BroadcastReceiver several extras. The onReceive fails to retrieve anything but the ALARM_COUNT extra though.

I've looked for a while and count find a solution. I've tried PendingIntent.FLAG.UPDATE.CURRENT multiple flags with the intent itself but nothing works.

Is there a better way to restore a views state from a BroadcastReceiver?


回答1:


"extras are all serialized into a byte stream in the Intent." I was improperly adding a custom object/class which caused the entire deserialization to fail.



来源:https://stackoverflow.com/questions/48629118/sending-extras-to-onreceive-only-retrieves-alarm-count

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!