【问题标题】:notification manager to start last open screen of the application通知管理器启动应用程序的最后打开屏幕
【发布时间】:2015-06-09 18:42:56
【问题描述】:

目前我正在处理通知。但是当我已经收到通知并且我在通知栏上单击了此通知时,我不必打开新活动。但我必须打开最近的活动。当一些数据保存在我最近的应用程序和在后台运行的应用程序并接收通知时,然后使用挂起的意图活动以onresume/oncrete 开头。但是我上次活动保存的数据已经丢失。因此,单击通知时的任何解决方案都不必重新启动活动。

请给我一些解决方案。

提前致谢。

【问题讨论】:

  • 你好,我已经使用 set intent to setflags 解决了我的问题。 Intent notificationIntent = null; notificationIntent = new Intent(mActivity, conductpd.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); notificationIntent.putExtra("MessageSender", chatHistory.getFromName());
  • 你可以回答你的问题并接受它:)
  • 表示你自己解决了这个问题..?
  • 是的..我自己解决了我的问题。
  • @dipali...太好了....恭喜...!!

标签: android android-intent notifications android-pendingintent


【解决方案1】:

我得到了解决方案。

在待处理的意图中添加标志以从堆栈中清除顶部/最近的活动。

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多