Push SDK

Mobile SDKs serving as a wrapper around Unifonic Push APIs

iOS

Register app

register(appId: String, completion: @escaping (_ sdkToken: String?, _ error: String?) -> ())

Register your app

appId - The application ID you get when you create a Push notifications Application.

Returns:

sdkToken - in case of success

error - in case of an error, nil otherwise

Save your push token

saveToken(identifier: String, pushToken: String, completion: @escaping (_ status: Bool, _ error: String?) -> ())

Sends your push notification to Unifonic

identifier - a unique identifier

pushToken - your apns token

Returns:

status - true/false

error - in case of an error, nil otherwise

Mark a notification

markNotification(type: NotificationReadType, userInfo: [String: Any], completion: @escaping (_ status: Bool, _ error: String?) -> ())

Mark a notification as either read or received

type - read/received

userInfo - payload dictionary

Returns

status - true/false

error - in case of an error, nil otherwise

Disable notification

disableNotification(identifier: String, completion: @escaping (_ status: Bool, _ error: String?) -> ())

Disables a notification if the user has turned off notifications from the settings app

identifier - your unique identifier

Returns:

status - true/false

error - in case of an error, nil otherwise

Android

register()

this method is used to call apps/register api

Parameters:

appId (application id / input from user)

identifier (input from user)

result handler

disableNotification()

this method is used to call bindings/update_status api

Parameters:

firebaseToken (obtained from firebase)

disabled (boolean; to check if notification is disabled on the device or not)

result handler

saveToken()

this method is used to call bindings or bindings/refresh apis

Parameters:

firebaseToken (obtained from firebase)

create (boolean; if old token exists then this boolean will be false and bindings/refresh api will be called, else

bindings api will be called)

oldFirebaseToken (string, can be null)

result handler

markNotification()

this method is used to call notifications/read or notifications/read apis

Parameters:

messageId (string; message id)

status (enum; read, received)

result handler