Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Notification after App is installed on device - How to?

I would like to add a Status Bar Notification for my Android App. This notification should be shown on the Status Bar after the App is installed. I have a background service for the App which is where I could put the notification code. How do I trigger the Notification only after the App is installed?

Any insight to solve this problem will be very helpful.

Thanks.

like image 650
Aakash Avatar asked Jan 29 '11 20:01

Aakash


People also ask

How do I get push notifications on Android?

Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.

What is floating notification?

Floating Notifications is now available on devices supporting Android OS 11 and above, so keep up-to-date with Conversations and app Notifications without having to scroll through your Notification panel by activating Floating Notifications on your Galaxy phone now.

Why are my notifications not showing?

Check if the notification appears in your Android notification bar or tray. Check that you have enabled notifications on your phone. Android Settings > Apps (then Manage Apps for some users) > Signal > Check on Show notifications. > Notifications > Enable message notifications.


2 Answers

There is a (major) exception to this rule. If your app was installed from the Android Market, the Market app will send an com.android.vending.INSTALL_REFERRER intent to your app upon installation. For example, AnySoftKeyboard displays a custom notification after it is installed:

enter image description here

It makes a lot of sense for a keyboard to display a notification because new keyboards are disabled by default, so a notification can prompt users to enable it. Otherwise most users would assume the install failed when their keyboard wasn't on the list of input devices (followed by angry support emails, or even worse -- BAD RATINGS AND REFUNDS!).

Refer to this page for more information: Get referrer after installing app from Android Market. I also found this code in the AnySoftKeyboard manifest file (located at http://softkeyboard.googlecode.com):

    <receiver android:name="com.anysoftkeyboard.receivers.AnySoftKeyboardInstalledReceiver" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

I hope this helps,

Barry

like image 130
Barry Fruitman Avatar answered Sep 30 '22 15:09

Barry Fruitman


How do I trigger the Notification only after the App is installed?

You cannot do this. None of your code will run immediately upon install.

like image 38
CommonsWare Avatar answered Sep 30 '22 13:09

CommonsWare