These docs are for v1.0. Click to read the latest docs for v2.0.

Push Notification

Handling Deeplink ( Android )

To handle deeplink in Background and Terminated state, add below code to listen for incoming value.

// Android callback to handle deeplink in terminated/background state.
    Smartech.getDeepLinkUrl(function (_response) {
      alert(_response.deeplink);
    });

To handle deeplink in Foreground state, Add listener using the Smartech.

// Adding the Smartech Deeplink Notification Listener
    Smartech.addListener(Smartech.SmartechDeeplinkNotification, handleDeeplinkWithPayload);

// Handling the SDK Deeplink Callback.
const handleDeeplinkWithPayload = (_response) => {
 console.log('Deeplink and Payload At JS App Level: ' + 		          JSON.stringify(_response));
 
};

Get FCM / APNS DeviceToken

To obtain the FCM token of the user from the SDK, add given snippet as per the requirement.

SmartechSDK.getDevicePushToken((error, devicePushToken) => {
      //Grab the devicePushToken   
});

Custom Push Notification Icon (Android)

With the launch of Android 5 (Lollipop), the notification icons are rendered differently in the notification bar at the top. By default, Smartech SDK uses the app’s icon for both, the small icon as well as the large icon.

To set a custom notification icon, add the following code in your Application class.

SMTNotificationOptions options = new SMTNotificationOptions(this);
options.setSmallIconTransparentId(R.drawable.ic_notif);
Smartech.getInstance(new WeakReference<>(context)).setNotificationOptions(options);
val options = SMTNotificationOptions(this)
options.smallIconTransparentId = R.drawable.ic_notif
Smartech.getInstance(WeakReference(context)).setNotificationOptions(options)

Note:
The notification icon being used should strictly be in .png format as per Google’s UI guidelines​. Preferable size for the push notification icons is mentioned below.

drawable-mdpi 		: 	24 x 24
drawable-hdpi 		: 	36 x 36 
drawable-xhdpi 		: 	48 x 48
drawable-xxhdpi 	: 	72 x 72
drawable-xxxhdpi 	: 	96 x 96

Changing Push Notification Icon Color (Android)

To change the colour of notification icon, add given snippet inside the onCreate() method of the Application Class​​.

SMTNotificationOptions options = new SMTNotificationOptions(this);
options.setTransparentIconBgColor("#007AFF");
Smartech.getInstance(new WeakReference<>(context)).setNotificationOptions(options);
val options = SMTNotificationOptions(this)
options.transparentIconBgColor = "#007AFF"
Smartech.getInstance(WeakReference(context)).setNotificationOptions(options)