Android安装apk

public void installApk() {

       File apkfile = new File(Environment.getExternalStorageDirectory(),

              strApkFile);

       Log.i("Update", apkfile.getAbsolutePath());

       if (!apkfile.exists()) {

           Log.d("Update", "文件不存在");

           return;

       }

       Log.i("Update", "启动");

       Intent i = new Intent(Intent.ACTION_VIEW);

       i.setDataAndType(Uri.parse("file://" + apkfile.toString()),

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

       startActivity(i);

    }

posted @ 2015-04-30 14:15  王志鑫  阅读(109)  评论(0编辑  收藏  举报