[英]Android: How to catch Intent's Extras if the activity is already running?
I put a notification in the status bar with a PendingIntent (with Extras info) that points to my main app (main activity). 我在状态栏中添加了一个通知,其中包含指向我的主应用程序(主要活动)的PendingIntent(带额外信息)。 When the user clicks the staus bar, the PendingIntent is fired and my app launches and I can read the Extras info in my onCreate() method.
当用户点击staus栏时,会激活PendingIntent并启动我的应用程序,我可以在onCreate()方法中读取Extras信息。 So far so good.
到现在为止还挺好。
But if my app is already running, the PendingIntent simply causes the app to come to the foreground and it does not call any of my methods, so I can't read the content in Extras. 但是如果我的应用程序已经在运行,PendingIntent只会导致应用程序到达前台并且它不会调用我的任何方法,因此我无法读取Extras中的内容。 What can I do?
我能做什么?
Thanks! 谢谢!
It does call a method. 它确实调用了一种方法。
Check out OnNewIntent 看看OnNewIntent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.