I would like to get some information (date,etc) when an app is installed/uninstalled, I have found some useful posts about how to achieve this with ACTION_PACKAGE_REMOVED & ACTION_PACKAGE_ADDED intents,but even with this I can not get the correct approach ... any help will be appreciated. Thanks. This is the a simple code i wr
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter android:priority="100" >
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
public class MyReceiver extends BroadcastReceiver {
public MyReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
// TODO: This method is called when the BroadcastReceiver is receiving
// an Intent broadcast.
Log.d("Receiver", "Intent: " + intent.getAction());
}
}
You should remove
<data android:scheme="package" />
from your <intent-filter>
EDIT
The question is ... how I can trigger the install/uninstall event for my own application?
You will not get information related to your own package.
This is a workaround you can use to track updates for your own app.
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.