Android Query phone installed third-party apps

Source: Internet
Author: User

1. Get the app name and package name for third-party apps installed on your phone and print

 private void Queryfilterappinfo () {
Packagemanager pm = this.getpackag Emanager ();
//query all installed applications
list<applicationinfo> listappcations = pm.getinstalledapplications (Package Manager.get_uninstalled_packages);
Collections.sort (Listappcations,new applicationinfo.displaynamecomparator (PM));//Sort
//third-party applications
for (ApplicationInfo app:listappcations) {
//non-system program
if (App.flags & App Licationinfo.flag_system) <= 0) {
log.e ("Sang", "+app.loadlabel (PM) +" Package name is: "+app.packagename");
}
//is a system program that was manually updated by the user, and the system program became a third-party application.
Else if (App.flags & Applicationin Fo. Flag_updated_system_app)! = 0) {
log.e ("Sang", "+app.loadlabel (PM) +" Package name is: "+app.packagename);
}
}
return;
}

Log output style, such as: "QQ package name is: COM.TENCENT.MOBILEQQ"!

Private List<pushdownlist> Queryfilterappinfo () {
PM = This.getpackagemanager ();
Querying all applications that have already been installed
list<applicationinfo> listappcations = pm.getinstalledapplications (packagemanager.get_uninstalled_packages) ;
Collections.sort (Listappcations,new Applicationinfo.displaynamecomparator (PM));//Sort
list<pushdownlist> Appinfos = new arraylist<pushdownlist> (); Save the filter found AppInfo

Third-party applications
Appinfos.clear ();
for (ApplicationInfo app:listappcations) {
Non-System programs
if ((App.flags & Applicationinfo.flag_system) <= 0) {
Appinfos.add (Getappinfo (APP));
}
Originally a system program, by the user manually updated, the system program has become a third-party application
else if ((App.flags & applicationinfo.flag_updated_system_app)! = 0) {
Appinfos.add (Getappinfo (APP));
}
}
return Appinfos;
}

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.