简体   繁体   English

在设备上安装App后的Android通知 - 如何?

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

I would like to add a Status Bar Notification for my Android App. 我想为我的Android应用添加状态栏通知。 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. 谢谢。

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. 如果您的应用是从Android电子市场安装的,那么Market应用会在安装时向您的应用发送com.android.vending.INSTALL_REFERRER意图。 For example, AnySoftKeyboard displays a custom notification after it is installed: 例如,AnySoftKeyboard在安装后会显示自定义通知:

在此输入图像描述

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 . 有关详细信息,请参阅此页面: 从Android电子市场安装应用后获取引荐来源 I also found this code in the AnySoftKeyboard manifest file (located at http://softkeyboard.googlecode.com ): 我还在AnySoftKeyboard清单文件(位于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. 安装后,您的代码都不会立即运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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