机器人:从应用程序code检测一个应用程序的重新安装 [英] android : detect the reinstall of an app from the app code
问题描述
有没有办法从应用程序code检测时被重新安装它。
Is there a way to detect from app code when it is being reinstalled.
我看到市场中的应用更新可通过广播接收器收听PACKAGE_REPLACED事件被检测到。但是,这些事件不会传递到应用程序,如果应用程序是由编辑器(蚀)重新安装。
I saw that app update from market can be detected by listening to PACKAGE_REPLACED event in broadcast receiver. But that these events are not delivered to the app , if the app is reinstalled from editor (eclipse ).
我的要求是,我禁用的组件(发射活动)。该应用程序安装,如果没有启用将失败。所以每次重装前,我要启用这个组件。
My requirement is that i am disabling a component(Launcher activity). The app install will fail if it is not enabled. SO everytime before reinstall i want to enable this component.
我在市场上发布之前谈论重新安装。在发展,每一次我重新安装该应用测试做一些修改,我想从我的应用程序检测到这一点,并作出启用组件。
I am talking about the reinstall before publishing in market. While developing , each time i reinstall the app to test some modification, i want to detect this from my app and make the component enabled.
推荐答案
我从我的例子中看到,当一个应用程序从日食重新安装以下事件将播出。
I saw from my example that the following events will be broadcasted when an app is reinstalled from eclipse.
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
</intent-filter>
我定义了一个广播接收这些行动并从的onReceive我能够让我的组件
I defined a broadcast receiver for these actions and from onreceive i am able to enable my component
这篇关于机器人:从应用程序code检测一个应用程序的重新安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!