0

I am able to fetch the list of the installed application in my code by package manager:

public ArrayList<InstalledAppData> importInstalledAppsData(){
        ArrayList<InstalledAppData> appList=new ArrayList<InstalledAppData>();
        PackageManager pkgManager=getApplicationContext().getPackageManager();
        List<ApplicationInfo> packages=getInstalledApplicationsList(pkgManager);
        String deviceId=Util.getDeviceId(getApplicationContext());

        for (ApplicationInfo packageInfo : packages) {
        String packageName=packageInfo.packageName;
        String appName="";
        String appFile = packageInfo.sourceDir;
        long installTime = new File(appFile).lastModified();
        String status="s";
        if ((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
                appName = (String) pkgManager.getApplicationLabel(packageInfo);
            }
            else {
            appName = (String) pkgManager.getApplicationLabel(packageInfo);
        }                
        InstalledAppData data=new InstalledAppData(deviceId, packageName, appName, installTime, status);
            appList.add(data);


        }
        return appList;
    }

Now i want to identify all installed apps on the phone that currently have location services enabled.How can i do this? Thnx in advance

1 Answers1

1

How can i do this?

You can't. The Android SDK has no means for one application to spy on another application's use of LocationManager.

You can register for the PASSIVE_PROVIDER to see if anyone happens to be requesting location updates, but you cannot tie it down to a specific application.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • If i want to fetch the permission list of all installed application then i can do this by packagemanager.getpermissions.But now i want to filter which applications have access_fine_location or access_coarse_location permission.Is that possible? – Nirupoma Saha Chaiti Apr 21 '12 at 20:42
  • 1
    @NirupomaSahaChaiti: Iterate over the installed applications and check the `permissions` data member of the `PackageInfo` object you get back for that package from `PackageManager`, I suppose. – CommonsWare Apr 21 '12 at 20:48