重新打开通过项目的通知后台应用 [英] re-open background application via notification item

查看:112
本文介绍了重新打开通过项目的通知后台应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序有标签和通知栏条目, 当我将其发送到后台(点击home键) 并试图通过点击重新打开应用程序 通知栏,应用程序重新启动(最后选定 选项​​卡丢失)。

I got an app with tabs and a notification bar entry, when I send it to background (click on home button) and try to re-open the application via click on the notification bar, the app restarts (last selected tab is lost).

当我按住home键,如果应用程序在 背景并从那里选择它,或者单击 应用程序的主屏幕上的图标,previous状态 每默认恢复(正确的选项卡中选择)

When I hold the home button if the application is in the background and select it from there or click the app's icon on the homescreen, the previous state is restored per default (the correct tab is selected)

国际海事组织通报的目的是错误的,但我 不知道如何解决它。

IMO the intent of the notification is wrong, but I'm not sure how to fix it.

简而言之:如何获得一个后台应用回 前台当我点击该通知条目?

In short: How to get a background application back to foreground when I click the notification entry?

THX!

推荐答案

把这两行。这将恢复目前已暂停活动:

Put these two lines. This will resume currently paused activity:

notificationIntent.setAction(Intent.ACTION_MAIN);
notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);

这篇关于重新打开通过项目的通知后台应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆