I know about the ACTION_MY_PACKAGE_REPLACED Intent action but what it do is - notifies the receiver AFTER the app got replaced.
But the things is - I want to know before the app is being replaced by another.
I tried with these actions
<receiver
android:name=".receivers.InstallReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
but doesn't help!