Completing the Integration

Configurable properties of SDK initialize

  • defaultActivity: The Activity by default is the initial screen of your app that is launched when a user clicks on a notification. It is also the point where you should initialize the SDK.
  • AutoRequestPushPermission: to request permission automatically or manually. Default value is true. But if you want to do manually, you have to add these methods
IndigitallFlutterPlugin.init({
    IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
    IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
    IndigitallParams.PARAM_REQUEST_LOCATION: true,
    IndigitallParams.PARAM_DEFAULT_ACTIVITY: "/",// main.dart
    "autoRequestPushPermission": true,
    }, (device)=> {
            //LOG device onIndigitallInitialized
    }, (device)  => {
                //LOG device onNewUserRegistered
    }, (error) => {
              //LOG IndigitallErrorModel
});

[...]

/* To get status push permission*/
IndigitallFlutterPlugin.getPushPermissionStatus(status => {
 /* STATUS: granted/notDeterminated/denied */
	print("status getPushPermissionStatus: ", status);
}, (error) => {
  print("ERROR getPushPermissionStatus: ", error);
});

[...]
 
 /* to request push permission */
IndigitallFlutterPlugin.requestPushPermission()

On Android you have to override the permission request result method to permit to the sdk to treat the permission result on android 13 or above. Add it on MainActivity:

class MainActivity: FlutterActivity() {


    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        IndigitallFlutterPlugin.onRequestPermissionsResult(context, requestCode, permissions, grantResults)
    }

  • alwaysLaunchOnInit: on the first time initializing on Android, callback onIndigitallInitialized is executed. Default value is false.
IndigitallFlutterPlugin.init({
    IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
    IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
    IndigitallParams.PARAM_REQUEST_LOCATION: true,
    "alwaysLaunchOnInit": true,
    }, (device)=> {
            //LOG device onIndigitallInitialized
    }, (device)  => {
                //LOG device onNewUserRegistered
    }, (error) => {
              //LOG IndigitallErrorModel
});

Callbacks offered by the SDK

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

IndigitallFlutterPlugin.init({
    IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
    IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
    IndigitallParams.PARAM_REQUEST_LOCATION: true 
    }, (device)=> {
            //LOG device onIndigitallInitialized
    }, (device)  => {
                //LOG device onNewUserRegistered
    }, (error) => {
              //LOG IndigitallErrorModel
});

Initialized SDK

The onIndigitallInitialized callback will be executed when the SDK finishes initializing and the device is ready to receive notifications from indigitall.

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

IndigitallFlutterPlugin.init(
      {
        IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
        IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
        IndigitallParams.PARAM_REQUEST_LOCATION: true 
      }, (device)=> {
            print("Device: " + device.toString());
      }, null, null);

New registered device

The onNewUserRegistered callback 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.

IndigitallFlutterPlugin.init({ 
  IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
  IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
  IndigitallParams.PARAM_REQUEST_LOCATION: true 
  }, null, (device)=> {
      print("Device: " + device.toString());
  }, null);

An error has occurred

The error method will run only if an error occurs during the initialization of the SDK.

It receives the description of the error as a parameter.

IndigitallFlutterPlugin.init({
  IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY", 
  IndigitallParams.PARAM_SENDER_ID: "YOUR_SENDER_ID", 
  IndigitallParams.PARAM_REQUEST_LOCATION: true 
  }, (device)=> {
      //LOG device
  }, (errorModel) => {
      print("Error: "+ errorModel.errorMessage);
  });