---
title: "安装apk的函数"
author: "googlelee"
date: "2012-04-12T13:04:31Z"
tags: []
categories: ["移动开发"]
slug: "apk"
draft: false
lastmod: "2012-04-12T13:04:31Z"
id: 1484295
url: "https://googlelee.iteye.com/blog/1484295"
---

private void installApk(){

Log.d("login", "apkFile="+apkFile);

File apkfile = new File(apkFile);  

if (!apkfile.exists()) {  

return;  

}      

Intent i = new Intent(Intent.ACTION\_VIEW);  

i.setDataAndType(Uri.parse("file://" + apkfile.toString()), "application/vnd.android.package-archive");   

this.startActivity(i);  

}