ACTION_APP_PRE_UNINSTALL

public final static String ACTION_APP_PRE_UNINSTALL

An intent service intent that indicates the target app will be uninstalled in the next 5 seconds. After 5 seconds any processes associated with the app are killed and the app is uninstalled. The service started by this intent must be an intent service.

Apps can use this time to perform any required cleanup actions. For example, remove any inventory items your app created that do not make sense without your app or order types created that are specific to your app. This intent should not trigger anything that is visible to or require any interaction with the user. Preferably all work is completed synchronously within the bounds of the android.app.IntentService's onHandleIntent method. Note that this is a service intent, not a broadcast intent. It must be received by an (intent) service, not a broadcast receiver.

<service
    android:name=".MyCleanupService"
    android:exported="true">
  <intent-filter>
    <action android:name="com.clover.intent.action._APP_PRE_UNINSTALL"/>
  </intent-filter>
</service>
This is only invoked for apps installed via the Clover app store, it is not invoked on development devices when adb uninstall is used. To test during development you may invoke this manually with the following command:
  adb shell am startservice -a com.clover.intent.action.APP_PRE_UNINSTALL -n your.packagename/.MyCleanupService