Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppUtils #28

Closed
Jasperben opened this issue Apr 12, 2023 · 2 comments
Closed

AppUtils #28

Jasperben opened this issue Apr 12, 2023 · 2 comments

Comments

@Jasperben
Copy link

Jasperben commented Apr 12, 2023

建议增加代码【获取所有已安装的应用】和【获取所有 能够显示在 桌面上的 应用】
获取所有已安装的应用
private List<String> getInstalledPackages(Context context) { List<String> installedPackageList = new ArrayList<>(); List<PackageInfo> installedPackageInfoList = context.getPackageManager().getInstalledPackages(PackageManager.MATCH_UNINSTALLED_PACKAGES); for (PackageInfo packageInfo: installedPackageInfoList) { installedPackageList.add(packageInfo.packageName); } return installedPackageList; }

获取所有 能够显示在 桌面上的 应用
`private List getAllLauncherIconPackages(Context context) {
List launcherIconPackageList = new ArrayList<>();

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);

    //set MATCH_ALL to prevent any filtering of the results
    List<ResolveInfo> resolveInfos = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_ALL);
    for (ResolveInfo info: resolveInfos) {
        launcherIconPackageList.add(info.activityInfo.packageName);
    }

    return launcherIconPackageList;
}

`

@afkT
Copy link
Owner

afkT commented Apr 12, 2023

方法 注释
getPackageInfoToFile 通过 APK 路径 初始化 PackageInfo
getPackageInfoToPath 通过 APK 路径 初始化 PackageInfo
getPackageInfo 获取当前应用 PackageInfo
getAppInfoBeanToFile 通过 APK 路径 获取 AppInfoBean
getAppInfoBeanToPath 通过 APK 路径 获取 AppInfoBean
getAppInfoBean 获取当前应用 AppInfoBean
getApkInfoItem 获取 APK 详细信息
getAppInfoItem 获取 APP 详细信息
getAppLists 获取全部 APP 列表
getAppPermissionToList 获取 APP 注册的权限
getAppPermissionToSet 获取 APP 注册的权限
getAppPermission 获取 APP 注册的权限
printAppPermission 打印 APP 注册的权限

第一个是有的,AppInfoUtils.getAppLists()、AppInfoUtils.getAppLists(AppInfoBean.AppType.USER)

第二个我找个时间加一下,最近再忙另外的开源项目,准备那个项目提交后,统一把 DevUtils 库都适配到最新然后发个版本。

@afkT
Copy link
Owner

afkT commented Jun 21, 2023

第二个方法添加了 AppInfoUtils#getAllLauncherIconPackageNames 等我发个版本就可以用了

@afkT afkT closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants