开发者

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 N开发者_StackOverflow中文版otification only after the App is installed?

Any insight to solve this problem will be very helpful.

Thanks.


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:

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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜