I need to clear cache and logout user everytime when app gets updated so that user will get latest data from backend. I have implement Support in-app updates but due to some playstore cache it didnt work on every users. I tried to register my broadcast receiver with following code:
<receiver android:name=".YourReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package"/>
</intent-filter>
</receiver>
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
intentFilter.addDataScheme("package");
registerReceiver(br, intentFilter);
but it didnt work and it didnt capture the app update event or removed event.
How can i capture the app update event when my app get updated automatically from playstore for the below scenario?
- User didn't open the app when app get update automatically
- User has opened the app when app get updated automatically