首页 > 代码库 > 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如何获取开机启动项列表