安装APK与Intent.ACTION_VIEW正在下载但不安装文件但不、文件、APK、Intent

2023-09-07 09:31:39 作者:﹏_莫尐尐ˋ

 乌里myUrl = Uri.parse(stringURL);意图UPDATE1 =新意图(Intent.ACTION_VIEW).setData(myUrl);startActivity(UPDATE1); 

这使得apk文件的下载,但下载安装后不会启动。你需要通过点击下载在通知栏完成手动启动它。这也是在大多数论坛答案溶液

 乌里myUrl = Uri.parse(stringURL);意图UPDATE2 =新意图(Intent.ACTION_VIEW).setDataAndType(myUrl,应用程序/ vnd.android.package归档);startActivity(UPDATE2); 

在这种情况下,我得到的消息(DDMS):无活动处理的意图......我也认为MIME应用/ vnd.android.package归档,是不是强制性的。这是真的?如果没有,你必须配置HTTP服务器,使这项工作。像.htaccess文件需要与被更新:

  

将AddType应用/ vnd.android.package存档

Starting Intent act android.intent.action.MAIN cat cmp com. 移动开发 JaneYork的博客 CSDN博客

如果是这样吗,你知道我可以测试的apk的任何一个环节,如果下载后,安装过程开始在这个网站自动(文件不是的样本的安装)。

时,我可以打电话从code安装任何意图解决办法?

解决方案   

你知道我可以测试,APK中的任何链接,如果下载后,安装程序会自动启动

我不知道这是可能的。

  

时,我可以打电话从code安装任何意图解决办法?

您可以自己下载的文件,然后做一个 ACTION_VIEW 意图本地APK文件。也就是说,据我所知,会立即弹出安装界面。

Uri myUrl = Uri.parse(stringURL); 
Intent update1 = new Intent(Intent.ACTION_VIEW).setData(myUrl);
startActivity( update1 );

This enables download of apk file, but after download install does not start. You need to start it manually by clicking download completed in notification bar. This is also solution in most forum answers.

Uri myUrl = Uri.parse(stringURL); 
Intent update2 = new Intent(Intent.ACTION_VIEW).setDataAndType(myUrl,"application/vnd.android.package-archive");
startActivity( update2 );

In this scenario i get message (DDMS): No Activity found to handle intent... I also think that MIME "application/vnd.android.package-archive" is not obligatory. Is this true? If not, do you have to config http server to make this work. Like .htaccess file needs to be updated with:

AddType application/vnd.android.package-archive

If is it so, do you know any link of apk that i can test, if after download, installation process starts automatically (files on this site are not samples installed).

Is any workaround that I can call install intent from code?

解决方案

do you know any link of apk that i can test, if after download, installation process starts automatically

I am not aware that this is possible.

Is any workaround that I can call install intent from code?

You can download the file yourself, then do an ACTION_VIEW Intent on the local APK file. That, AFAIK, will immediately bring up the installation screen.