Configurable properties of SDK initialize
SDK versions < 6.0.0
Config class of push initialization is named PushConfig.
Initial Configuration: log debug
You can customize the init configuration with the following parameters:
- debugMode: set the debug level on Log to show: Debug, info, warning or error
let config = INPushConfig.init(appKey: "<YOUR-APP-KEY>")
config.debugMode = IN_DEBUG
Indigitall.initialize(with: config, onIndigitallInitialized: nil, onErrorInitialized: nil);
INPushConfig *config = [[INPushConfig alloc]initWithAppKey:appKey];
config.debugMode = IN_DEBUG;
[Indigitall initializeWithConfig:config onIndigitallInitialized:nil onErrorInitialized:nil];
Callbacks offered by the SDK
Our SDK offers various callbacks that help you have greater control of the execution flow and implement custom behaviors.
To subscribe to these callbacks you have to:
- Pass the functions as parameters on initialization.
let config = INPushConfig.init(appKey: "<YOUR-APP-KEY>")
config.debugMode = IN_DEBUG
Indigitall.initialize(with: config, onIndigitallInitialized: { (permissions, device) in
//DO SOMETHING
}) { (error) in
//LOG ERROR
}
INPushConfig *config = [[INPushConfig alloc]initWithAppKey:appKey];
config.debugMode = IN_DEBUG;
[Indigitall initializeWithConfig:config onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
//DO SOMETHING
} onErrorInitialized:^(INError * _Nonnull onError) {
//LOG ERROR
}];
Initialized SDK
The onIndigitallInitialized method will run when the SDK finishes initializing and the device is ready to receive notifications from indigitall.
Receive as parameter:
- An array of String. The first item is the status of the claims permission. The second item is the status of the locate permission.
- A device object with the information associated with the device.
Here we show you an element that prints logs about the status of permissions and device information.
let config = INPushConfig.init(appKey: "<YOUR-APP-KEY>")
config.debugMode = IN_DEBUG
Indigitall.initialize(with: config,
onIndigitallInitialized: { (permission, device) in
print("onIndigitallInitialized Push \(permissions[0].permissionType) permission: \(permissions[0].permissionStatus)")
print("onIndigitallInitialized Location \(permissions[0].permissionType) permission: \(permissions[1].permissionStatus)")
print("onIndigitallInitialized DEVICE: \(device.deviceID )")
}, onErrorInitialized: { (error) in
//LOG ERROR
}
INPushConfig *config = [[INPushConfig alloc]initWithAppKey:appKey];
config.debugMode = IN_DEBUG;
[Indigitall initializeWithConfig:config onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
NSLog(@"onIndigitallInitialized Device: %@",device.deviceID);
NSLog(@"onIndigitallInitialized Permission push: %u : %u", permissions[0].permissionType, permissions[0].permissionStatus );
NSLog(@"onIndigitallInitialized Permission location: %u: %u",permissions[1].permissionType, permissions[1].permissionType)
} onErrorInitialized:^(INError * _Nonnull onError) {
//LOG ERROR
}];
New registered device
The onNewUserRegistered method will be executed when the device has been assigned the push token to receive notifications, that is, in the first execution of the app after being installed and after having accepted permissions. This is defined in the AppDelegate as callback of the call to the setDeviceToken described above.
It receives as a parameter the Device object with the information associated with the device.
Indigitall.setDeviceToken(deviceToken) { (token) in
print("NewUserRegistered: \(token)")
}
[Indigitall setDeviceToken:deviceToken onNewUserRegistered:^(INDevice * _Nonnull device) {
NSLog(@"Device: %@",device);
}];
An error has occurred
The onErrorInitialized method will be executed only if an error occurs during the initialization of the SDK.
It receives the error description as a parameter.
let config = INPushConfig.init(appKey: "<YOUR-APP-KEY>")
config.debugMode = IN_DEBUG
Indigitall.initialize(with: config,
onIndigitallInitialized: { (permission, device) in
//DO SOMETHING
}, onErrorInitialized: { (error) in
print("ERROR: \(error.message)")
}
INPushConfig *config = [[INPushConfig alloc]initWithAppKey:appKey];
config.debugMode = IN_DEBUG;
[Indigitall initializeWithConfig:config onIndigitallInitialized:^(NSArray<INPermissions *> * _Nonnull permissions, INDevice * _Nonnull device) {
//DO SOMETHING
} onErrorInitialized:^(INError * _Nonnull onError) {
NSLog(@"Error Initialized: %@",onError);
}];