当我的Android应用程序被删除,我想也删除的应用程序已经在SD卡上创建的文件,因为这些可以消耗很多兆字节,并且只使用到我的应用程序。Android在去除包装不接受意向ACTION_PACKAGE_REMOVED
看来,收到包装中取出的意图是做这个的地方。 然而,我的广播接收器不会被调用 - 它似乎被送到
除去包装意图之前已被删除的代码是:
public class UninstallReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action= intent.getAction(); Log.i("U", "ACTION " + action); etc. } }
,并在清单:
<application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name ="com.boom.UninstallReceiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_REMOVED"/> <data android:scheme="package" /> </intent-filter> </receiver>
此权限只授予系统应用。所以我不能在我的应用程序中使用它。 – Borys 2013-06-07 15:39:34
这个答案是错的。为了发送广播意图'PACKAGE_REMOVED' **,需要此权限。即使系统会授予你这个权限(它不会),它仍然不会帮助你。这个答案应该被删除。 – 2015-04-12 11:09:48