Packagemanager for Android

Source: Internet
Author: User

Packagemanager Problems

This class of API is an encapsulation of all data structures based on information loading, including the following functions:

Install and uninstall an application to query permission information

Query application-related information (application, activity, Cycler, service, provider, and related attributes)

Query installed applications

Add and delete permission

Clear user data, cache, code segments, etc.

/** <Br/> * packagemanager Introduction: <br/> * this type of API encapsulates all data structures based on loading information, including the following functions: <br/> * install and uninstall an application. query permission information and query application information. <br/> * Information (application, activity, Cycler, service, provider, and related attributes) <br/> * added query installed applications. Deleting permission requires specific permissions to clear user data, caches, code segments, and other non-query-related APIs. <Br/> * contains the following information about the application package installed on the current device: <br/>: obtain information about the installed application <br/> */<br/> private hashmap <string, string> installpackagesinfo () {<br/> // obtain the packagemanager object <br/> packagemanager = This. getpackagemanager (); <br/>/* getinstalledapplications return the set of application packages installed on the current device <br/> * applicationinfo corresponds to androidmanifest. the application tag in XML. You can obtain information about the application <br/> */<br/> List <applicationinfo> applicationinfos = packagemanager. getinstalledapplications (0); <br/> hashmap <string, string> resultmap = new hashmap <string, string> (); <br/> iterator <applicationinfo> iterator = applicationinfos. iterator (); <br/> while (iterator. hasnext () {<br/> applicationinfo = iterator. next (); <br/> string packagename = applicationinfo. packagename; // package name <br/> string packagelabel = packagemanager. getapplicationlabel (applicationinfo ). tostring (); // obtain the label <br/> resultmap. put (packagelabel, packagename); <br/>}</P> <p> return resultmap; </P> <p>}

In addition, we found several interesting methods in the packagemanager class.

 

 

Xmlresourceparse getxml (string packagename, int resid, applicationinfo appinfo) can load an XML file from a specified package.

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.