[英]Launching an Android app from notification bar : Just after installation
When you install an app from Google Play Web store through PC web browser on an Android device. 在Android设备上通过PC网络浏览器从Google Play网上商店安装应用时。 A notification, "App successfully installed", will be seen on notification bar of the android device. 将会在Android设备的通知栏上看到一条“应用已成功安装”通知。 I have seen for many apps (LinkedIn app etc), a click on this notification will launch the app itself. 我见过许多应用程序(LinkedIn应用程序等),单击此通知将启动应用程序本身。 How can I implement the same for my app? 如何为我的应用实现相同功能? Any pointers? 有指针吗? Currently, for my app, if I click on this notification it will open play store app and show the uninstall option. 目前,对于我的应用程序,如果我单击此通知,它将打开play store应用程序并显示卸载选项。 I dont want that :( 我不想要:(
I searched for "launching app from notification bar", but it talks about creating an notification (pendingintent) and all. 我搜索了“从通知栏启动应用程序”,但它涉及创建通知(待定)以及全部。 But in my scenario the notification is created by Google play services. 但是在我的情况下,通知是由Google Play服务创建的。 So how to launch my app when user click on this notification "app successfully installed"? 那么,当用户单击此通知“应用已成功安装”时,如何启动我的应用?
Thank you so much, 非常感谢,
The notification is displayed by Google Play app after installation automatically, for every app that is downloaded from Google Play, you don't need to do something special for it. 通知会在安装后由Google Play应用自动显示,对于从Google Play下载的每个应用,您都不需要做任何特别的事情。 :-) :-)
It seems that if your application does not have an Activity that declares an intent-filter for the launcher, then the notification won't open your app and instead will open the Google Play listing for it. 看来,如果您的应用程序没有为启动器声明意图过滤器的活动,则通知不会打开您的应用程序,而是会为其打开Google Play列表。
I'm not sure what your app does, but most of the time you want to something the user can launch anyway. 我不确定您的应用程序会做什么,但是大多数时候您都希望用户可以启动某些程序。 Reasons include: 原因包括:
If your app really isn't supposed to have a launcher activity, you could use PackageManager
to disable the activity after they've opened it the first time. 如果您的应用程序确实不应该具有启动器活动,则可以在第一次打开活动后使用PackageManager
禁用该活动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.