Flutter Push Library

Flutter wrapper library for Unifonic Push

Installation

Add the following dependency in pubspec.yaml file:

unifonic_push_sdk:  
  path: {path to sdk}

Usage

Add the following import statement in main.dart file:

import 'package:unifonic_push_sdk/unifonic_notice_sdk.dart';

Create a variable for SDK:

UnifonicSDK? unifonicSdk;

Initialize the variable in main() function:

unifonicSdk = UnifonicSDK(baseUrl: DevEnv().baseUrl, enableLoggingInterceptor: true);

API

Methods

  1. register - Registers your app with Unifonic

Parameters:

appId- refers to the App ID you receive from Unifonic

identifier- a unique identifier

Returns:

sdkToken - a token

unifonicSdk!.register(AppId, identifier)
  1. markNotification - mark notification as either read or received

Parameters:

type: NotificationReadType (read/received)
messageId: Message ID received in push notification's payload

Returns:

boolean: truein case of success,false\ otherwise

unifonicSdk!.markNotification(type, messageId)
  1. enableNotification: enables the notifications for the current device
    Returns:
    boolean: true in case of success, false otherwise
  2. disableNotification: disables the notifications for the current device
    Returns:
    boolean: true in case of success, false otherwise
  3. saveToken: sends the push-token to Unifonic backend
    Parameters:
    pushToken: apn in case of iOS, fcm in case of Android
    Returns:
    boolean': truein case of success,false` otherwise