Cleaning up app-specific data on uninstallation

Your app may create data specific to your application that will not be needed if the app is uninstalled. This data could be inventory items required by your app or types of orders specific to the app. To prevent the merchant from being confused by any leftover data when the app is removed, you should remove this app-specific information.

The SDK provides a service intent called ACTION_APP_PRE_UNINSTALL for this purpose. To use the intent, add the following to your app's manifest:

<service
     android:name=".MyCleanupService"
     android:exported="true">
   <intent-filter>
     <action android:name="com.clover.intent.action._APP_PRE_UNINSTALL"/>
   </intent-filter>
 </service>

When this intent is fired, the app will be uninstalled in the next five seconds, so your app should use this interval perform any required cleanup actions. Cleanup should be done in the background and not require any user interaction.

Testing uninstallation actions with ADB

Running adb uninstall alone will not trigger this intent. To manually invoke it for testing purposes, run the following command: adb shell am startservice -a com.clover.intent.action.APP_PRE_UNINSTALL -n your.packagename/.MyCleanupService.


Did this page help you?