Install apk with Intent.ACTION_VIEW is downloading but not installing the file
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,开发者_Go百科 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.
精彩评论