Is it possible to detect the remove of a specific application in android? If yes how ? this my code that detect the remove of any package, how can i change it to detect the desired application ?
import android.content.*;
import android.util.Log;
public class PackageChangeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
if(intent.getAction().equals("android.intent.action.PACKAGE_REMOVED")) {Log.i("action","the package is removed");}
}
}
and this is the manifest
<receiver android:name="PackageChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<data android:scheme="package"/>
</intent-filter>
I don’t think you can filter the broadcasts for a specific package name. However, you can retrieve (and then test) the package name easily enough when you receive the broadcast:
(There’s a nice sample class, PackageMonitor, at DevDaily.com that was my source for the above code fragment.)