PHP
·
发表于 5年以前
·
阅读量:8290
public static void installApk(Context context, File file) {
Intent intent = new Intent();
intent.setAction( "android.intent.action.VIEW" );
intent.addCategory( "android.intent.category.DEFAULT" );
intent.setType( "application/vnd.android.package-archive" );
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive" );
intent.setFlags(Intent.FLAG\_ACTIVITY\_NEW_TASK);
context.startActivity(intent);
}