手记

android实现静默卸载

静默卸载 --调用Android未公开的API(uninstallPackage)来实现,需在源码下编译
        PackageManager pm = context.getPackageManager();
        pm.deletePackage(packageName, observer, 0);

然后继承静默卸载状态回调类 
public class PackageDeleteObserver extends IPackageDeleteObserver.Stub {
    private Context context;
    private Handler handler;

    public PackageDeleteObserver() {
    }

  
    @Override
    public void packageDeleted(String packageName, int returnCode) {
        
//        Log.e("PackageDeleteObserver", "packageName = " + packageName);
//        Log.e("PackageDeleteObserver", "returnCode = " + returnCode);
        
    }
}
还有几种静默卸载的方法 但是都要root或者要系统权限 用系统的签名
原文链接:http://www.apkbus.com/blog-508687-62963.html

0人推荐
随时随地看视频
慕课网APP