The Code calls the Android Application to uninstall
In Android applications, a few are offered to uninstall their own applications, that is, some of the most uninstall applications. I personally think that, from the product perspective, it is not necessary to provide an uninstallation.
The following describes how to uninstall the SDK from a technical perspective.
The principle is to set an intent for uninstalling the specified package, and then process the application that is interested in this intent. In this example, the system's uninstalling management is usually used for receiving and processing by default. In the following code, we need to input a string-type package name. Generally, you can obtain the string type package name by calling the getpackagename () method of the context object in the activity. The specific source code is as follows.
/*** Uninstall APK file * @ Param packagename */Public void uninstallapk (string packagename) {URI uri = Uri. parse ("package:" + packagename); intent = new intent (intent. action_delete, Uri); this. context. startactivity (intent );}
Last modified: 2011-12-11
For more technical articles visit: http://thinkblog.sinaapp.com