Customer Engagement
For Android SDK
Step 1: Complete basic setup
Go to Basic Setup to start integrating your Android project with CEE 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 CEE 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)
*Handling deeplink
The below method will provide the deep link value and custom payload.
SmartechPlugin().handleDeeplinkAction((String? link, Map<dynamic, dynamic>? map, bool? isAfterTerminated) {
if (link == null || link.isEmpty) {
return;
}
// Handle the deeplink
});
We also need to handle deeplink in the terminate state so add the below code inside the main. dart file or put inside the class called by your application.
SmartechPlugin().onhandleDeeplinkActionBackground();
For iOS SDK
Go to Customer Engagement to start integrating your iOS project with CEE 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 about 1 year ago
Go on to setting up user and event tracking or go back to basic setup