我得到第三方应用程序标签,但我发现有些标签是不正常的。pm.getInstalledPackages()
和pm.getInstalledApplications()
都是。getApplicationLabel()
和loadlabel()
方法都是这样的。
有些标签以packageName.*.Application
结尾。有些标签以*.xml
结尾。
如何解决这个问题?
JAVA代码
StringBuilder appName = new StringBuilder();
PackageManager pm = getApplicationContext().getPackageManager();
List<ApplicationInfo> applicationsInfo = pm.getInstalledApplications(PackageManager.MATCH_UNINSTALLED_PACKAGES);
for (ApplicationInfo appInfo : applicationsInfo) {
if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0)
continue;
String label = pm.getApplicationLabel(appInfo).toString();
appName.append(appInfo.packageName).append(" ").append(label).append('\n');
}
Log.i(TAG, "APP NAME: \n"+appName);
部分结果
com.GizmoVR.Virtual.Reality.Videos res/layout/abc_list_menu_item_icon.xml
com.lonelycatgames.Xplore com.lonelycatgames.Xplore.App
com.microsoft.office.excel com.microsoft.office.excel.excelApplication
com.videogo 萤石云视频
com.tencent.blackkey com.tencent.blackkey.MOOApplication
com.baidu.netdisk.youth com.baidu.netdisk.youth.ShellApplication
com.baidu.netdisk com.baidu.netdisk.ShellApplication
com.taobao.taobao 淘宝
io.fusetech.stackademia Researcher
org.xxx.fuckkuan res/animator-v21/design_appbar_state_list_animator.xml
cn.myflv.android.noanr res/color/abc_background_cache_hint_selector_material_dark.xml
com.netease.cloudmusic 网易云音乐
tv.danmaku.bili 哔哩哔哩
com.google.earth 地球
com.eg.android.AlipayGphone 支付宝
cn.wps.moffice_eng WPS Office
com.microsoft.todos To Do
发布于 2022-07-06 10:36:34
问题似乎解决了。
它似乎只出现在调试应用程序时,当以Apply Changes and Restart Activity
模式运行时。
https://stackoverflow.com/questions/72876857
复制相似问题