简体   繁体   English

从我的应用程序卸载其他应用程序,处理用户输入

[英]Uninstall other apps from my application, handling user input

I used the code, it works fine.我使用了代码,它工作正常。 In the uninstall process it asks the user to choose an uninstaller option (packageinstaller and my app).在卸载过程中,它要求用户选择一个卸载程序选项(packageinstaller 和我的应用程序)。 How to skip this?如何跳过这个? or how detect which button clicked by user?或者如何检测用户点击了哪个按钮? (ok or cancel) (确定或取消)

 Uri packageURI = Uri.parse("package:com.android.myapp");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);

private class LoadViewTask extends AsyncTask<String, Void, String>  
{

 @Override  
    protected String doInBackground(String... params)  
    {  
        //here dell app with startActivity(uninstallIntent);
     BlackListActivity.getInstance().dellApp(params[0]);
     return "done";
    }   

 @Override
 protected void onPostExecute(String sss) {
    //when call update list,program has stoped, how detect uninstall process done
     BlackListActivity.getInstance().updatedData();
    // super.onPostExecute(null);
    
    }
 }

You won't be able to manage the user's apps unless you have what's called the firmware key.除非您拥有所谓的固件密钥,否则您将无法管理用户的应用程序。 Essentially, that would give your app special rights that a standard app won't have.从本质上讲,这会给您的应用程序提供标准应用程序所没有的特殊权限。 Otherwise, there will always be some user interaction with install/uninstall.否则,总会有一些用户与安装/卸载交互。

If you didn't build and deploy the OS, you won't get the firmware key.如果您没有构建和部署操作系统,您将无法获得固件密钥。 You'd need to contact the manufacturer and have them sign your app for you, and unless you're ordering many thousands of devices from them, they won't do that (and usually not then either).您需要联系制造商并让他们为您签署您的应用程序,除非您从他们那里订购数千台设备,否则他们不会这样做(通常也不会这样做)。

I would guess you'll get virtually no info from whatever app is opened to actually do the uninstall.我猜你几乎不会从打开的任何应用程序中获得任何信息来实际执行卸载。 I could be wrong, but I highly doubt it.我可能是错的,但我非常怀疑。

You could try to query the current apps in the system and find the package name of whatever's on top.可以尝试查询系统中的当前应用程序并找到最上面的任何内容的包名称。 That'll at least give you info on what the user opened to remove the app, but you'll need to do something really fast, assuming the user is in the process of uninstalling your app (unless, of course, you have a separate app installed doing the watching).这至少会给你关于用户打开什么来删除应用程序的信息,但你需要做一些非常快的事情,假设用户正在卸载你的应用程序(当然,除非你有一个单独的安装的应用程序正在观看)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM