您的位置:首页 > 其它

通过网页链接地址下载apk安装包

2013-05-20 12:36 344 查看
String url = "http://192.168.0.1:80/test/a.apk"

Uri uri = Uri.parse(url);

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent );

 如果是一个apk文件,打开并且安装的函数为 

Java代码  



private void openFile(File file) {   

        // TODO Auto-generated method stub   

        Log.e("OpenFile", file.getName());   

        Intent intent = new Intent();   

        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);   

        intent.setAction(android.content.Intent.ACTION_VIEW);   

        intent.setDataAndType(Uri.fromFile(file),   

                        "application/vnd.android.package-archive");   

        startActivity(intent);   

}    
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: