
有少量需求,在软件卸载的时候做少量动作,但是我最近发现,在5.1上,覆盖安装的时候会发remove和replace两种intent,这样会导致功能异常,处理方案有2
if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED)) { String packageName = intent.getData().getSchemeSpecificPart(); boolean booleanReplacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); LogUtils.e("booleanReplacing:" + booleanReplacing); LogUtils.e("remove:" + packageName); if (!booleanReplacing) { //这里是真正的卸载 } }2.监听Intent.ACTION_PACKAGE_FULLY_REMOVED
这个广播是应用被卸载,数据被时才会发,所以,这是真正的被卸载的时候会发的。