【问题标题】:How can I save PendingIntent as an object into Realm, from notificationserviceListener?如何从 notificationserviceListener 将 PendingIntent 作为对象保存到 Realm 中?
【发布时间】:2017-10-13 16:15:01
【问题描述】:

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

【问题讨论】:

  • 我认为..您应该给出您想要获得解决方案的整个用例(带有屏幕截图),并且保存 pendingIntent 不是为您提供解决方案的问题。
  • 兄弟有解决办法吗?

标签: android notifications android-notifications notificationservices


【解决方案1】:

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

【讨论】:

  • 你能告诉我,我怎样才能从通知ID中找到pendingIntent?这对我很有帮助:)
  • 您能告诉我您将如何使用 pendingIntent 吗?有什么用例吗?
  • 我想在离线数据库中保存 statusBarNotification 内容,如标题、消息、股票行情、图标、pendingIntent。然后,将其显示在列表中。然后,当用户点击每个项目时,我想将他/她发送到 pendingIntent,我为每个通知保存在离线数据库中。
  • 在列表中点击你要发送pendingIntent?
  • 使用recycleView,我想将用户发送到pendingIntent :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多