Completing the Integration

Callbacks offered by the SDK

Our SDK offers various callbacks that help you have greater control of the execution flow and implement custom behaviors.

Initialized SDK

📘

Xamarin Classic: Android version

From version 1.16.1 you have to set the activity context to be able to receive push notifications.

Indigitall.setContext(this);

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 Permission objects. 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 is an example that prints logs about the status of permissions and device information.

var indigitall = DependencyService.Get<IIndigitall>();
if (indigitall != null)
{
  //android version*****
  indigitall.setContext(this);
  //********
    indigitall.Init("YOUR APPKEY", "YOUR SENDER ID", true, (permissions, device)=>
    {
        Console.WriteLine("device: " + device.deviceId);
        Console.WriteLine("device: " + permissions);
    },(device)=>
    {
        //DO SOMETHING
    },(errorCode,errorMessage)=>
    {
        //DO SOMETHING
    });

//or also
Com.Indigitall.Xamarin.Models.IConfiguration config = new Com.Indigitall.Xamarin.Models.IConfiguration();
config.appKey = "<YOUR-APP-KEY>";
config.senderId = "<YOUR-SENDER-ID>";
indigitall.Init(config, (permissions, device) =>
{
    Console.WriteLine("device: " + device.deviceId);
    Console.WriteLine("device: " + permissions);
}, (device) =>
{
    //DO SOMETHING
}, (errorCode,errorMessage) =>
{
    //DO SOMETHING
});

New registered device

The onNewUserRegistered method will be executed when the device has been registered for the first time, that is, in the first execution of the app after being installed.

It receives as a parameter the Device object with the information associated with the device.

var indigitall = DependencyService.Get<IIndigitall>();
if (indigitall != null)
{
    indigitall.Init("YOUR APPKEY", "YOUR SENDER ID", true, (permissions, device)=>
    {
        //DO SOMETHING
    },(device)=>
    {
        Console.WriteLine("device: " + device.deviceId);
    },(errorCode,errorMessage)=>
    {
        //DO SOMETHING
    });

An error has occurred

The onErrorInitialized method will be executed only if an error occurs during the initialization of the SDK.

It receives the description of the error as a parameter.

var indigitall = DependencyService.Get<IIndigitall>();
if (indigitall != null)
{
    indigitall.Init("YOUR APPKEY", "YOUR SENDER ID", true, (permissions, device)=>
    {
        //DO SOMETHING
    },(device)=>
    {
        //DO SOMETHING
    },(errorCode,errorMessage)=>
    {
        Console.WriteLine("ErrorCode: " + errorCode+" Message: "+ errorMessage);
    });