如何在手机本地保存待处理的意图

Ter*_*wis 5 android android-pendingintent

我需要存储从 StatusBarNotification 对象获取的 PendingIntent 对象。PendingIntentendingIntent=sbn.getNotification().contentIntent;

Dav*_*ser -2

APendingIntent可以序列化为字节流,因为它是Parcelable。创建一个Parcel,调用writeToParcel()PendingIntent对象序列化到 中Parcel,然后调用marshall()Parcel获取字节,然后您可以将其写入设备上的文件。

注意:该Parcelable界面并不是为长期持久性而设计的,因此这可能不适用于所有情况。这取决于您想用它做什么。