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;
}