I've already tried several things and now I've put all actions into one receiver:
<receiver android:name=".ReceiverClass">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
This is my Receiver class
public class ReceiverClass extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) {
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
}
if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) {
Toast.makeText(context, "2", Toast.LENGTH_LONG).show();
System.out.println("test");
}
if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) {
Toast.makeText(context, "3", Toast.LENGTH_LONG).show();
System.out.println("test");
}
if (Intent.ACTION_PACKAGE_INSTALL.equals(intent.getAction())) {
Toast.makeText(context, "4", Toast.LENGTH_LONG).show();
System.out.println("test");
}
if (Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) {
Toast.makeText(context, "5", Toast.LENGTH_LONG).show();
System.out.println("test");
}
if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) {
Toast.makeText(context, "6", Toast.LENGTH_LONG).show();
System.out.println("test");
}
}
}
None of the Toasts get displayed, when I manuall install a new signed APK. Is there something I am missing as the only really replied posts are from 2015 or even earlier. Time flies.