The Code calls the Android Application to uninstall

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.