将其他内容发送到onReceive仅会检索ALARM_COUNT [英] Sending Extras to onReceive only retrieves ALARM_COUNT
问题描述
我创建了一个自定义视图,该视图使用AlarmManager设置了警报.我想稍后再恢复此视图,所以我尝试向BroadcastReceiver发送一些附加信息.该onReceive无法检索除ALARM_COUNT之外的任何内容.
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.
我已经寻找了一段时间,并希望找到解决方案.我已经用意图本身尝试了PendingIntent.FLAG.UPDATE.CURRENT多个标志,但无济于事.
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.
是否有更好的方法可以从BroadcastReceiver恢复视图状态?
Is there a better way to restore a views state from a BroadcastReceiver?
推荐答案
所有扩展都已在Intent中序列化为字节流."我添加了不正确的自定义对象/类,导致整个反序列化失败.
"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.
这篇关于将其他内容发送到onReceive仅会检索ALARM_COUNT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!