简体   繁体   English

以编程方式更新apk(无root)

[英]update apk programmatically (without root)

I want to update my android application programmatically. 我想以编程方式更新我的android应用程序。

I used following code: 我使用以下代码:

 final Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(Uri.fromFile(new 
       File(Environment.getExternalStorageDirectory()+"/AndroidTest.apk")), "application/vnd.android.package-archive");

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

This code display dialogue box to install application. 此代码显示对话框以安装应用程序。

I want to install apk automatically. 我想自动安装apk。

Please help me. 请帮我。

Fortunately, this is not possible, for obvious security reasons. 幸运的是,出于明显的安全原因,这是不可能的。 Apps cannot install apps without user intervention, with the exception of certain system apps that have the right permissions and such. 应用程序无法在没有用户干预的情况下安装应用程序,但某些具有适当权限等的系统应用程序除外。

是可以,请检查出来 。为此,您需要SUPER_USERACCESS添加此权限: <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />

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

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