---
title: "一般情况下安装APK"
author: "rafale35"
date: "2012-10-11T20:23:19Z"
tags: []
categories: ["移动开发"]
slug: "apk"
draft: false
lastmod: "2012-10-11T20:23:19Z"
id: 1696711
url: "https://rafale35.iteye.com/blog/1696711"
---

```
    private void installNormal() {
        LogUtils.log(TAG, LogUtils.getThreadName());
        setStatus(State.INSTALLING);
        String rootpath = Environment.getExternalStorageDirectory().getPath()
                + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator;
        Uri uri = Uri.fromFile(new File(rootpath + downloadFileName));
        LogUtils.log(TAG, LogUtils.getThreadName() + "uri = " + uri);
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(Intent.ACTION_VIEW);
        intent.setDataAndType(uri, "application/vnd.android.package-archive");
        mContext.startActivity(intent);

    }
```