问题
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