Appearance
Sessions License
When sessions licensing is employed, the license server provides the SDK with an allocated number of measurements (or "quota") as specified in Binah's license agreement.
The SDK requires an internet connection, allowing it to communicate with the license server in order to verify the license validity.
Measurement Consumption
Upon calling the start
method the SDK instructs the license server to consume a single measurement and changes the session state from ready to starting. If no measurements are available on the server, then the process will be aborted and the SDK will send an error and the session will transition back to stopping and ready state (see Session State).
Note
The SDK shares the activation ID with the application also when using a sessions license. However, the activation quota is unlimited when using this type of license.
Time Left for License Timer
To support cases where a session was consumed from the license quota, but the measurement failed for any reason like incoming phone call, the application can perform repeated measurements without consuming additional sessions from the license. A “session timeframe” timer is triggered when starting the first measurement. The timer is set initially to 9 minutes (540 seconds). During this timeframe the application can perform repeated measurements without consuming additional sessions from the license.
The following code can be used to update the device user interface or to decide if the user is still entitled to repeat a measurement. The Offline Measurements End Time is the time remaining on the timer. When this timer expires, then a starting new measurement will result consuming a new session from the license quota.
The application can receive the timer end time by implementing onLicenseInfo
as part of SessionInfoListener
:
Swift
func onLicenseInfo(licenseInfo: LicenseInfo) {
DispatchQueue.main.async {
guard let offlineMeasurements = licenseInfo.licenseOfflineMeasurements else {
return
}
print("Offline Measurements: \(offlineMeasurements.totalMeasurements)")
print("Remaining Offline Measurements: \(offlineMeasurements.remainingMeasurements)")
print("Offline Measurements End Time: \(offlineMeasurements.measurementEndTimestamp)")
}
}
func onLicenseInfo(licenseInfo: LicenseInfo) {
DispatchQueue.main.async {
guard let offlineMeasurements = licenseInfo.licenseOfflineMeasurements else {
return
}
print("Offline Measurements: \(offlineMeasurements.totalMeasurements)")
print("Remaining Offline Measurements: \(offlineMeasurements.remainingMeasurements)")
print("Offline Measurements End Time: \(offlineMeasurements.measurementEndTimestamp)")
}
}
Objective-C
- (void)onLicenseInfoWithLicenseInfo:(BNHLicenseInfo *)licenseInfo {
dispatch_async(dispatch_get_main_queue(), ^{
BNHLicenseOfflineMeasurements *offlineMeasurements = licenseInfo.licenseOfflineMeasurements;
if (!offlineMeasurements) {
return;
}
NSLog(@"Offline Measurements: %ld", (long)offlineMeasurements.totalMeasurements);
NSLog(@"Remaining Offline Measurements: %ld", (long)offlineMeasurements.remainingMeasurements);
NSLog(@"Offline Measurements End Time: %ld", (long)offlineMeasurements.measurementEndTimestamp);
});
}
- (void)onLicenseInfoWithLicenseInfo:(BNHLicenseInfo *)licenseInfo {
dispatch_async(dispatch_get_main_queue(), ^{
BNHLicenseOfflineMeasurements *offlineMeasurements = licenseInfo.licenseOfflineMeasurements;
if (!offlineMeasurements) {
return;
}
NSLog(@"Offline Measurements: %ld", (long)offlineMeasurements.totalMeasurements);
NSLog(@"Remaining Offline Measurements: %ld", (long)offlineMeasurements.remainingMeasurements);
NSLog(@"Offline Measurements End Time: %ld", (long)offlineMeasurements.measurementEndTimestamp);
});
}
Remaining Measurements and Offline Measurements
Note
This section is relevant only for licenses with a custom configuration of more than 1 offline measurement, as configured in Binah.ai's license server. This configuration requires the assistance of Binah’s support team.
By default, the licensing mechanism is configured to consume 1 measurement from the license's quota on the server upon calling the session start
method. Some licenses are configured to fetch additional measurements from the server and store them locally on the SDK for future use. This allows the application to start additional sessions even if the device has no live internet access.
The following parameters indicate the status of the locally stored measurements:
- Offline Measurements - The total number of measurements that can be stored locally on the device.
- Remaining Measurements - The total number of measurements that were already downloaded from the server to the SDK and can be used in future sessions.
The application can receive the information regarding offline measurements by implementing onLicenseInfo
as part of SessionInfoListener
:
Swift
func onLicenseInfo(licenseInfo: LicenseInfo) {
DispatchQueue.main.async {
guard let offlineMeasurements = licenseInfo.licenseOfflineMeasurements else {
return
}
print("Offline Measurements: \(offlineMeasurements.totalMeasurements)")
print("Remaining Offline Measurements: \(offlineMeasurements.remainingMeasurements)")
print("Offline Measurements End Time: \(offlineMeasurements.measurementEndTimestamp)")
}
}
func onLicenseInfo(licenseInfo: LicenseInfo) {
DispatchQueue.main.async {
guard let offlineMeasurements = licenseInfo.licenseOfflineMeasurements else {
return
}
print("Offline Measurements: \(offlineMeasurements.totalMeasurements)")
print("Remaining Offline Measurements: \(offlineMeasurements.remainingMeasurements)")
print("Offline Measurements End Time: \(offlineMeasurements.measurementEndTimestamp)")
}
}
Objective-C
- (void)onLicenseInfoWithLicenseInfo:(BNHLicenseInfo *)licenseInfo {
dispatch_async(dispatch_get_main_queue(), ^{
BNHLicenseOfflineMeasurements *offlineMeasurements = licenseInfo.licenseOfflineMeasurements;
if (!offlineMeasurements) {
return;
}
NSLog(@"Offline Measurements: %ld", (long)offlineMeasurements.totalMeasurements);
NSLog(@"Remaining Offline Measurements: %ld", (long)offlineMeasurements.remainingMeasurements);
NSLog(@"Offline Measurements End Time: %ld", (long)offlineMeasurements.measurementEndTimestamp);
});
}
- (void)onLicenseInfoWithLicenseInfo:(BNHLicenseInfo *)licenseInfo {
dispatch_async(dispatch_get_main_queue(), ^{
BNHLicenseOfflineMeasurements *offlineMeasurements = licenseInfo.licenseOfflineMeasurements;
if (!offlineMeasurements) {
return;
}
NSLog(@"Offline Measurements: %ld", (long)offlineMeasurements.totalMeasurements);
NSLog(@"Remaining Offline Measurements: %ld", (long)offlineMeasurements.remainingMeasurements);
NSLog(@"Offline Measurements End Time: %ld", (long)offlineMeasurements.measurementEndTimestamp);
});
}