我添加了一个带有意图过滤器的活动来拦截我的应用程序的卸载,以便在用户卸载我的应用程序时添加一些额外的处理/清理。我的活动被调用得很好,但我似乎无法完成从设备中删除包的过程。
<activity
android:name=".Uninstall"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.DELETE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
</activity>
当我使用包管理器尝试完成卸载时,它只会弹出相同的选择器对话框。
Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", Uninstall.this.getPackageName(), null));
startActivity(intent);
如果我为我的应用程序提供替代卸载活动,我如何完成从设备上实际卸载 apk?
谢谢。