首页 > 代码库 > Android如何获取开机启动项列表
Android如何获取开机启动项列表
static final String BOOT_START_PERMISSION = "android.permission.RECEIVE_BOOT_COMPLETED"; public List<Map<String, Object>> fetch_installed_apps(){ List<ApplicationInfo> packages = getPackageManager().getInstalledApplications(); list = new ArrayList<Map<String, Object>>(packages.size()); Iterator<ApplicationInfo> appInfoIterator = packages.iterator(); while (appInfoIterator.hasNext()) { ApplicationInfo app = (ApplicationInfo) appInfoIterator.next(); //查找安装的package是否有开机启动权限 if(PackageManager.PERMISSION_GRANTED== getPackageManager().checkPermission(BOOT_START_PERMISSION, app.packageName)) { String label = getPackageManager().getApplicationLabel(app).toString(); Drawable appIcon = getPackageManager().getApplicationIcon(app); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", label); map.put("desc", app.packageName); map.put("img",appIcon); list.add(map); } } return list; }
Android如何获取开机启动项列表
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。