码迷,mamicode.com
首页 > 移动开发 > 详细

Android如何获取开机启动项列表

时间:2014-12-09 00:22:02      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:des   android   style   blog   io   ar   color   os   sp   

 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如何获取开机启动项列表

标签:des   android   style   blog   io   ar   color   os   sp   

原文地址:http://www.cnblogs.com/zuiyirenjian/p/4152219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!