如何将PendingIntent作为对象从notificationserviceListener保存到Realm中?

问题描述:

使用NotificationServiceLister,我检索通知的pendingIntent。现在我想将pendingIntent作为一个对象存储到任何离线数据库中,例如realm, greendao, sqlite, ormLite, active android等。这可能吗?如果可能的话,那么,怎么样?或者有没有其他方法可以找到任何特定通知的pendingIntent如何将PendingIntent作为对象从notificationserviceListener保存到Realm中?

+0

我想..你应该给你想要得到一个解决方案和保存pendingIntent的整个用例(截图)不是问题,将为您提供解决方案。 – Asad

而不是保存pendingIntent对象。您可以将唯一通知ID存储到数据库中。点击Notification活动即可启动,您可以在其中提取notification id,并通过将其与本地数据库进行比较来查看点击了哪个通知。

+0

你能告诉我,我怎么能从通知ID找到pendingIntent?它会对我很有帮助:) –

+0

你能告诉我你到底会如何使用pendingIntent吗?任何用例? –

+0

我想在离线数据库中保存statusBarNotification类似的东西,标题,消息,股票代码,图标,pendingIntent。然后,将其显示在列表中。然后,当用户点击每个项目时,我想将他/她发送给pendingIntent,这是我在每个通知中保存在离线数据库中的。点击列表上的 –