---
title: "代码安装android应用"
author: "wonka438"
date: "2012-02-09T15:48:15Z"
tags: []
categories: ["移动开发"]
slug: "android"
draft: false
lastmod: "2012-02-09T15:48:15Z"
id: 1399508
url: "https://wonka438.iteye.com/blog/1399508"
---

```
String str = "/niao.apk";
String fileName = Environment.getExternalStorageDirectory() + str;
Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent);
```