简体   繁体   English

从通知栏启动Android应用程序:安装后

[英]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. 看来,如果您的应用程序没有为启动器声明意图过滤器的活动,则通知不会打开您的应用程序,而是会为其打开Goog​​le 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: 原因包括:

  1. Apps are in a stopped state after being installed and remain in that state until they are launched by the user. 应用在安装后处于停止状态,并保持该状态直到用户启动它们。 In this state, none of your application components will run. 在这种状态下,任何应用程序组件都不会运行。
  2. Users may want a way to see what your app is doing and interact with it, even if it's just limited to configuring some settings. 用户可能想要一种方法来查看您的应用程序正在执行的操作并与之交互,即使仅限于配置某些设置也是如此。 You can leverage this to do other things, like provide a feedback link. 您可以利用它来做其他事情,例如提供反馈链接。

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.

相关问题 Android状态栏通知虽然已经运行,但会启动新应用。 如何从应用程序图标和状态栏通知同步启动应用程序? - Android statusbar notification launches new app though it running already. How to synchronize launching app from app icon and staus bar notification? 安装应用程序后在 android 工作室中启动活动时出错 - Error While launching activity in android studio after the app installation Android通知持续启动应用 - Android notification keeps launching app 从Android通知栏启动应用。 如何启动应用程序的新实例而不是恢复后台进程? - Launching app from Android Notification Bar. How to start a fresh instance of application rather than resume background process? Android - 从通知启动活动 - Android - Launching Activity from Notification 从通知栏安装android应用 - installing android app from notification bar 防止应用覆盖 Android 通知栏 - Prevent app from overriding the Android notification bar 从状态栏通知启动Webview类 - Launching webview class from status bar notification 在Android中启动第三方应用程序的安装 - Launching installation for a 3rd party app in Android 在Android中点击通知时,应用未启动 - App is not launching when tapped on notification in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM