如何在Android 6及更高版本上处理卸载意图? [英] How to handle uninstall intent on Android 6 and above?

查看:146
本文介绍了如何在Android 6及更高版本上处理卸载意图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的" 应用管理器"应用程序,我处理了卸载意向,以便用户可以使用root在后台卸载应用程序.

On my "app manager" app, I handled uninstall intent so that users could uninstall apps in the background, using root.

在Android 5.x之前,所有版本都运行良好且运行良好,但似乎从Android 6开始,情况已经发生了变化,并且即使日志被使用,该应用程序也无法使用相同的意图.

Up to Android 5.x , all went well and worked fine, but it seems that starting from Android 6, things have changed and the same intent, even though the logs say is being used, cannot be used by the app.

清单包含了该活动的意图过滤器,就像往常一样:

The manifest includes this intent-filter for the activity, as it always had:

  <intent-filter>
    <action android:name="android.intent.action.DELETE"/>
    <action android:name="android.intent.action.UNINSTALL_PACKAGE"/>

    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="package"/>
  </intent-filter>

这是由于文档 此处 > 此处 ,它表示框架使用的是这些.

This is because of the docs, here and here, it says that those are what the framework uses.

我尝试分离操作,并尝试查看日志,但是它与以前的日志完全相同.示例:

I tried to separate the actions, and I tried to look at the logs, but it's exactly the same logs as before. Example:

system_process I/ActivityManager:启动u0 {act = android.intent.action.DELETE dat = package:me.scan.android.client flg = 0x10800000 cmp = com.google.android.packageinstaller/com.android.packageinstaller.UninstallerActivity (有其他功能)},显示为0的uid 10078

system_process I/ActivityManager: START u0 {act=android.intent.action.DELETE dat=package:me.scan.android.client flg=0x10800000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.UninstallerActivity (has extras)} from uid 10078 on display 0

似乎框架已经决定哪个应用程序可以处理意图.

It seems as if the framework already decided which app would handle the intent.

是否仍然可以处理卸载意图?即使有根?

Is it possible to still handle uninstall-intent? Even with root?

推荐答案

每个此提交,这是一个有意更改,首先出现在

Per this commit, this was an intentional change first seen in the marshmallow-release branch to disallow intercepting the package uninstall UI.

这篇关于如何在Android 6及更高版本上处理卸载意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆