public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if("android.intent.action.PACKAGE_REMOVED".equals(action)) { String appName = intent.getDataString(); if(PACKAGE_NAME.equals(appName)) { Log.i(TAG, "package removed, package name = "+appName); } } }
<receiver android:name=".MyReceiver"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>