This article describes the installation and uninstallation methods of Android programming software. Share it for your reference, as follows:
Install: from sdcard
String fileName = () + "/"; Intent intent = new Intent(Intent.ACTION_VIEW); (("file://" + filePath),"application/-archive");
or
//((new File(fileName)), "application/-archive"); startActivity(intent);
Install or upgrade from the network
Intent intent = new Intent(); (Intent.FLAG_ACTIVITY_NEW_TASK); (.ACTION_VIEW); /* Call getMIMEType() to get MimeType */ String type = getMIMEType(f); /* Set the file and MimeType of the intent */ ((f),type); startActivity(intent);
NeedPermissions
<uses-permission android:name=""></uses-permission> <uses-permission android:name=".INSTALL_PACKAGES"></uses-permission> <uses-permission android:name=".MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission> <uses-permission android:name=".WRITE_EXTERNAL_STORAGE"></uses-permission>
uninstall
Uri packageURI = ("package:"); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); startActivity(uninstallIntent);
I hope this article will be helpful to everyone's Android programming design.