Is it possible to intercept app uninstall?

前端 未结 1 889
北荒
北荒 2021-01-21 12:47

Is it possible to intercept app uninstall and make some job? E.g. my app modifies some files of device, so it would be neat before uninstalling just rollback changes made by my

相关标签:
1条回答
  • 2021-01-21 13:09

    Are you talking about the similar issue

    Listen Broadcast Before application uninstall

    Then as said you have to use the intent-filter for delete as given in the above link.

    <activity
        android:name=".UninstallIntentActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
    
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.DELETE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="package"  />
        </intent-filter>
    </activity>
    

    and when you get notified , do whatever you want.

    0 讨论(0)
提交回复
热议问题