以编程方式在Android上安装应用程序 [英] Install Application programmatically on Android

查看:128
本文介绍了以编程方式在Android上安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的想知道是否有可能以编程方式从一个自定义的Andr​​oid应用程序安装动态下载APK。

I`m interested in knowing if it is possible to programmatically install a dynamically downloaded apk from a custom Android application.

推荐答案

您可以轻松地推出市场链接或安装提示:

You can easily launch a market link or an install prompt:

Intent promptInstall = new Intent(Intent.ACTION_VIEW)
    .setDataAndType(Uri.parse("file:///path/to/your.apk"), 
                    "application/vnd.android.package-archive");
startActivity(promptInstall); 

<一个href="http://groups.google.com/group/android-developers/browse_thread/thread/bfc3c6deaa87a16">source

Intent goToMarket = new Intent(Intent.ACTION_VIEW)
    .setData(Uri.parse("market://details?id=com.package.name"));
startActivity(goToMarket);

<一个href="http://stackoverflow.com/questions/2893350/how-to-launch-the-market-intent-in-give-feedback-mode-on-android">source

但是,你不能没有安装.apks用户的明确许可的;不,除非设备和程序的根源。

However, you cannot install .apks without user's explicit permission; not unless the device and your program is rooted.

这篇关于以编程方式在Android上安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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