The example in this article describes the Android implementation of simple code installation and uninstall APK method. Share to everyone for your reference, specific as follows:
public class testinstallapk extends activity {
@Override
protected void onCreate (Bundle savedinstancestate) { c3/>//TODO auto-generated Method Stub
super.oncreate (Savedinstancestate);
This.uninstallfile ();
Installfile ();
}
/**
* Install APK code
*
/private void Installfile () {
Intent Intent = new Intent (Intent.action_view) ;
Intent.addflags (intent.flag_activity_new_task);
Intent.setaction (Android.content.Intent.ACTION_VIEW); String type = GetMimeType (f); Intent.setdataandtype (Uri.fromfile (f), type);
Intent.setdataandtype (Uri.parse ("file://" + "/sdcard/android_gc.apk"),
"application/ Vnd.android.package-archive ");
This.startactivity (intent);
}
/**
* Uninstall APK code
*
/private void Uninstallfile () {
Uri uri=uri.parse ("Package: Com.gameclient ");
Intent Intent = new Intent (Intent.action_delete,uri);
This.startactivity (intent);
}
For more information on Android-related content readers can view the site topics: "Android Development Introduction and Advanced Course", "Android debugging techniques and common problems solution summary", "Android Multimedia operating skills Summary (audio, video, recording, etc.)", " Android Basic Components Usage Summary, Android View tips Summary, Android layout layout tips and Android Control usage summary
I hope this article will help you with the Android program.