Blankj / Blankj/AndroidUtilCode

关于AppUtils的建议

Open
#1,521 0 comments 0 reactions 1 assignee Claimed by @Blankj View on GitHub
bug
Dominant language
Java
Stars
33.6k
Forks
10.6k
PR merge metrics
No merged PRs in 30d

Description

AppUtils类的getAppInfo(final String packageName)方法返回的name字段是根据ApplicationInfo的loadLabel获取的,也就是对应AndroidManifest的application标签的lable。但是在google的Launcher2或者Launcher3的源码中名称获取是通过下面代码获取的:
`final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
mainIntent.setPackage(packageName);
List infos = mPm.queryIntentActivities(mainIntent, 0);`
也就是取的启动activity的lable。建议AppUtils类的getAppInfo(final String packageName)方法获取的name改成与gogole相同的方式比较好,因为google已经适配了当activity没有设置lable的时候会再取application的lable。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.