安装APK与Intent.ACTION_VIEW正在下载但不安装文件 [英] Install apk with Intent.ACTION_VIEW is downloading but not installing the file

查看:717
本文介绍了安装APK与Intent.ACTION_VIEW正在下载但不安装文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 乌里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存档


如果是这样吗,你知道我可以测试的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.

这篇关于安装APK与Intent.ACTION_VIEW正在下载但不安装文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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