安装:从sdcard
- String fileName = Environment.getExternalStorageDirectory() + "/myApp.apk";
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(Uri.parse("file://" + filePath),"application/vnd.android.package-archive");
- 或者
- //intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
- startActivity(intent);
卸载
- Uri packageURI = Uri.parse("package:com.android.myapp");
- Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
- startActivity(uninstallIntent);
原文http://blog.csdn.net/fenghome/archive/2010/06/16/5673757.aspx