Check the Location Permissions

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

iOS
Android
SENTSDKStatus *currentStatus = [[SENTSDK sharedInstance] getSdkStatus];
if(currentStatus.isLocationPermGranted) {
// We are good!
} else {
// Permission denied
}
SdkStatus currentStatus = Sentiance.getInstance(context).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:

iOS
Android
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
}];
SdkConfig config = new SdkConfig.Builder(appId, secret, notification)
.setOnSdkStatusUpdateHandler(new OnSdkStatusUpdateHandler() {
@Override
public void onSdkStatusUpdate (SdkStatus status) {
if (status.isLocationPermGranted) {
//We are good!
} else {
//Permission denied
}
}
})
.build();
// Initialize the Sentiance SDK.
Sentiance.getInstance(this).init(config, this);