单击内置的apk,安装已经内置到系统中的apk
package com.wind.bbminstaller;
import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class MainActivity extends Activity {
static final int REQUEST_INSTALL = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
installerBBM();
}
private void installerBBM() {
Uri uri = Uri.fromFile(new File("/data/app/BBM.apk"));
Intent intent2 = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent2.setData(uri);
intent2.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
intent2.putExtra(Intent.EXTRA_RETURN_RESULT, true);
intent2.putExtra(Intent.EXTRA_ALLOW_REPLACE, true);
intent2.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME,getApplicationInfo().packageName);
startActivityForResult(intent2, REQUEST_INSTALL);
}
}从一个内置apk中安装另一个内置的apk
原文:http://blog.csdn.net/u012554768/article/details/38017291