To know if GPS is connected use this code:
LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE );
bool isOn = manager.isProviderEnabled( LocationManager.GPS_PROVIDER);
I think there is no way to know which applications are currently using GPS.
You can, however, know which apps are allowed to use it:
PackageManager p = context.getPackageManager();
List<PackageInfo> appInstaladas = p.getInstalledPackages(PackageManager.GET_PERMISSIONS);
This code fills in the appInstaladas
list with information about installed applications, including their permissions.
To get the list of permissions use, for each of the appInstaladas
items:
//Retorna permissões declaradas em <uses-permission>
String[] requestedPermissions = appInstaladas.get(index).requestedPermissions();
//Retorna permissões declaradas em <permission>
PermissionInfo[] permissions = appInstaldas.get(index).permissions();
Sources: PackageInfo.requestedPermissions PackageInfo.permissions
SO.com