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
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)
markNotification
- mark notification as eitherread
orreceived
Parameters:
type
: NotificationReadType (read/received)
messageId
: Message ID received in push notification's payload
Returns:
boolean
: true
in case of success,false\
otherwise
unifonicSdk!.markNotification(type, messageId)
enableNotification
: enables the notifications for the current device
Returns:
boolean
:true
in case of success,false
otherwisedisableNotification
: disables the notifications for the current device
Returns:
boolean
:true
in case of success,false
otherwisesaveToken
: 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
Updated 11 months ago