Smartech

Customer Engagement

For Android SDK

Step 1: Complete basic setup
Go to Basic Setup to start integrating your Android project with Smartech Plugin.

Step 2: Integrate Firebase Cloud Messaging in your app
Please follow Google’s Documentation to set up FCM Plugin in your app, if it is not already done.

Provide token via setDevicePushToken() and notification payload via handlePushNotification() methods to Smartech SDK. handlePushNotification() method will only display a notification if the Notification payload originated from Netcore and will safely ignore if not. The code of the class should look similar to the following:

if (Platform.isAndroid) {
    var token = await FirebaseMessaging.instance.getToken();
    SmartechPlugin().setDevicePushToken(token);

    FirebaseMessaging.onMessage.listen((event) {
      if (event != null) {
        if (event.data != null) {
          SmartechPlugin().handlePushNotification(event.data.toString());
        }
      }
    });

//This method for to handle background notification
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  SmartechPlugin().handlePushNotification(message.data.toString());
}

}

Retrieving Deeplink Data

Register the BroadcastReceiver inside the Application class.

DeeplinkReceivers deeplinkReceiver = new DeeplinkReceivers();
IntentFilter filter = new IntentFilter("com.smartech.EVENT_PN_INBOX_CLICK");
registerReceiver(deeplinkReceiver, filter);
val deeplinkReceiver = DeeplinkReceivers()
val filter = IntentFilter("com.smartech.EVENT_PN_INBOX_CLICK")
registerReceiver(deeplinkReceiver, filter)

Write the following code in the onCreate function of the launcher activity of your application.

new DeeplinkReceivers().onReceive(this, getIntent());
DeeplinkReceivers().onReceive(this, intent)

For iOS SDK

Go to Customer Engagement to start integrating your iOS project with Smartech Plugin.

Retrieving Deeplink Data

func handleDeeplinkAction(withURLString deeplinkURLString: String, andCustomPayload customPayload: [AnyHashable : Any]?) {
        SwiftSmartechPlugin.handleDeeplinkAction(withURLString: deeplinkURLString, andCustomPayload: customPayload)
        }
SmartechPlugin()
      .handleDeeplinkAction((String link, Map<dynamic, dynamic> map) {
}

Updated 2 months ago


Next

Go on to setting up user and event tracking or go back to basic setup

Basic Setup
User & Event Tracking

Customer Engagement


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.