Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top