Check the Location Permissions

This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to https://docs.sentiance.com.

To get current location permission status, use the getSdkStatus method (iOS / Android).

SENTSDKStatus *currentStatus = [[SENTSDK sharedInstance] getSdkStatus];
if(currentStatus.isLocationPermGranted) {
	// We are good!
} else {
	// Permission denied
}

In the above example, getSdkStatus returns an SDK status object (iOS / Android) which has an isLocationPermGranted field, indicating if the correct permission has been granted by the user to allow SDK detections.

The user must grant the background location access permission in order for SDK detections to work. This is presented as the "always" option on iOS and the "allow all the time" option on Android 10+.

To be notified of SDK status changes such as permission changes, quota updates, and the detection or SDK start status, you can set up an SDK status listener on the SDK's config object as follows:

SENTConfig *conf = [[SENTConfig alloc] initWithAppId:APPID
secret:SECRET launchOptions:launchOptions];

conf.didReceiveSdkStatusUpdate = ^(SENTSDKStatus *status) {
	if(status.isLocationPermGranted) {
		//We are good!
	} else {
		//Permission denied
	}
};

[[SENTSDK sharedInstance] initWithConfig:conf
success:^{
	// SDK init success.
	// Start SDK here
} failure:^(SENTInitIssue issue) {
	//SDK Failed to init
}];

Last updated