Here's what I've been using in iOS 9. If I rememeber correctly, appsUsingLocationWithDetails
returns a dictionary of all apps that are registered for location services. LocationTechnologiesInUse
contains an array of technologies being used by the app to update location data but its values are unknown to me. Probably some enum with values indicating that GPS, WiFi hotspots, cell towers or something else used. It doesn't really matter as the array will contain something only if the app uses location services at the moment. Here's an example:
for (NSDictionary* app in [[CLLocationManager sharedManager] appsUsingLocationWithDetails].allValues)
{
if ([app[@"LocationTechnologiesInUse"] count] > 0)
{
//the app uses location services
}
}
There're maybe some entitlement you will need to access that information. My daemon is signed with these entitlements with boolean value set to true.
com.apple.locationd.authorizeapplications
com.apple.locationd.preauthorized
com.apple.locationd.effective_bundle
com.apple.locationd.status
com.apple.CoreLocation.PrivateMode
Try using them if my code example doesn't work for you. It's been a long time since a wrote that piece of code and unfortunately I didn't document all entitlements. My daemon was already signed with these and the code above just worked, so maybe something is needed or may be not.