问题描述
我有通知的广播接收机。我的应用程序是一个WebKit的,我想,当用户点击通知我的应用程序被打开,并定向到一个特定的URL。一切似乎都做工精细,但我现在已经遇到了一个问题....
I have a broadcast receiver for notification. My app is a webkit, and I want my app to be opened and directed to a certain URL when user clicks on the notification. Everything seems to be working fine, but I've encountered a problem now....
onNewIntent()
是,如果用户上次退出由pressing home键的应用程序调用。但 onNewIntent()
是不是如果用户从后退按钮退出调用。任何人都可以请帮助?
onNewIntent()
is called if the user last exited the app by pressing home button. but onNewIntent()
is not called if the user exited from back button. can anyone please help?
推荐答案
Home键不(通常)杀死你的应用程序,它只是被采取关闭屏幕。发送给它的任何意图将被发送到 onNewIntent()
。
The home button doesn't (usually) kill your application, it just gets taken off the screen. Any intents sent to it would be sent to onNewIntent()
.
后退按钮通常会导致你的活动,以彻底退出。通过的onCreate从头发送到将开始它的任何意图()
。
The back button usually causes your activity to exit outright. Any intents sent to it would start it again from scratch via onCreate()
.
请注意,在一般情况下,任何时间应用程序不在屏幕上,它可以由系统杀死以节约资源。这意味着你的应用程序必须的总是的是ppared重新启动本身$ P $从的onCreate()
。无论你在 onNewIntent正在做的()
,你需要能够从的onCreate处理它()
,以及
Note that in general, any time your application isn't on the screen, it can be killed by the system to conserve resources. This means that your application must always be prepared to restart itself from onCreate()
. Whatever you're doing in onNewIntent()
, you need to be able to handle it from onCreate()
as well.
这篇关于Android的onNewIntent()通知没有正确行事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!