简体   繁体   中英

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. A notification, "App successfully installed", will be seen on notification bar of the android device. I have seen for many apps (LinkedIn app etc), a click on this notification will launch the app itself. 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. 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. 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. :-)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM