Flutter versions
0.3.3 without geofence with huawei
0.3.4 without geofence without huawei
0.3.5 with geofence with huawei
0.3.6 with geofence without huawei
FOR IOS:
pod 'Dengage', :git => 'https://github.com/dengage-tech/dengage-ios-sdk.git', :branch => 'version/5.1.1'
For with geofence
pod 'Dengage', :git => 'https://github.com/dengage-tech/dengage-ios-sdk.git', :branch => 'version/5.1.2'
Replace
coordinator.setupDengage(key: "K8sbLq1mShD52Hu2ZoHyb3tvDE_s_l_h99xFTF60WiNPdHhJtvmOqekutthtzRIPiMTbAa3y_p_l_PZqpon8nanH8YnJ8yYKocDb4GCAp7kOsi5qv7mDR_p_l_qOFLLp9_p_l_lloC6ds97X", launchOptions: launchOptions as NSDictionary?);
With
For geofence:
coordinator.setupDengage(key: "4vPb6ldynxkMe5_p_l_j5mk_s_l_Mzf5IDjqoARjx_s_l_KQEBB1iw6c2EDnH7bz6QTIHsdGSCkeJP2kO7ZSD_s_l_PDTkB6jyG8ebacnSdRsenDLujyQwFZTxQNOUiiGgoLCoEJ_s_l_NhkNVg2UQOFMZPpAXr6P_p_l_R6PXBujw_e_q__e_q_", enableGeoFence : true,launchOptions: launchOptions as NSDictionary?, application: application);
Without geofence:
coordinator.setupDengage(key: "4vPb6ldynxkMe5_p_l_j5mk_s_l_Mzf5IDjqoARjx_s_l_KQEBB1iw6c2EDnH7bz6QTIHsdGSCkeJP2kO7ZSD_s_l_PDTkB6jyG8ebacnSdRsenDLujyQwFZTxQNOUiiGgoLCoEJ_s_l_NhkNVg2UQOFMZPpAXr6P_p_l_R6PXBujw_e_q__e_q_",launchOptions: launchOptions as NSDictionary?, application: application);
ADD below line in didFinishLaunchingWithOptions
UNUserNotificationCenter.current().delegate = self
ADD 2 New Functions
override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let coordinator = DengageCoordinator.staticInstance;
coordinator.didReceivePush(center, response, withCompletionHandler: completionHandler)
}
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.alert, .sound, .badge])
}
For Android:
Change dependency to 5.6.1 for non geofence
5.6.2 without huawei and geofence
5.6.3 with geofence with huawei
5.6.4 with geofence without huwaei
REPLACE Service in manifest :
com.dengage.sdk.FcmMessagingService
com.dengage.sdk.HmsMessagingService
To
com.dengage.sdk.push.FcmMessagingService
com.dengage.sdk.push.HmsMessagingService
If they have registered any receiver for carousel then
Change their carousel structure to this
import com.dengage.sdk.domain.push.model.CarouselItem
import com.dengage.sdk.domain.push.model.Message
import com.dengage.sdk.push.NotificationReceiver
class PushNotificationReceiver : NotificationReceiver() {
override fun onCarouselRender(
context: Context,
intent: Intent,
message: Message,
leftCarouselItem: CarouselItem,
currentCarouselItem: CarouselItem,
rightCarouselItem: CarouselItem
) {
super.onCarouselRender(
context,
intent,
message,
leftCarouselItem,
currentCarouselItem,
rightCarouselItem
)
val itemTitle = currentCarouselItem.title
val itemDesc = currentCarouselItem.description
// set intents (right button, left button, item click)
val itemIntent = getItemClickIntent(intent.extras, context.packageName)
val leftIntent = getLeftItemIntent(intent.extras, context.packageName)
val rightIntent = getRightItemIntent(intent.extras, context.packageName)
val deleteIntent = getDeleteIntent(intent.extras, context.packageName)
val contentIntent = getContentIntent(intent.extras, context.packageName)
val carouseItemIntent = getPendingIntent(context, 0, itemIntent)
val carouselLeftIntent = getPendingIntent(context, 1, leftIntent)
val carouselRightIntent = getPendingIntent(context, 2, rightIntent)
val deletePendingIntent = getPendingIntent(context, 4, deleteIntent)
val contentPendingIntent = getPendingIntent(context, 5, contentIntent)
// set views for the layout
val collapsedView = RemoteViews(
context.packageName,
R.layout.den_carousel_collapsed
)
collapsedView.setTextViewText(R.id.den_carousel_title, message.title)
collapsedView.setTextViewText(R.id.den_carousel_message, message.message)
val carouselView = RemoteViews(
context.packageName,
R.layout.den_carousel_portrait
)
carouselView.setTextViewText(R.id.den_carousel_title, message.title)
carouselView.setTextViewText(R.id.den_carousel_message, message.message)
carouselView.setTextViewText(R.id.den_carousel_item_title, itemTitle)
carouselView.setTextViewText(R.id.den_carousel_item_description, itemDesc)
carouselView.setOnClickPendingIntent(R.id.den_carousel_left_arrow, carouselLeftIntent)
carouselView.setOnClickPendingIntent(
R.id.den_carousel_portrait_current_image,
carouseItemIntent
)
carouselView.setOnClickPendingIntent(R.id.den_carousel_item_title, carouseItemIntent)
carouselView.setOnClickPendingIntent(R.id.den_carousel_item_description, carouseItemIntent)
carouselView.setOnClickPendingIntent(R.id.den_carousel_right_arrow, carouselRightIntent)
val channelId = createNotificationChannel(context, message)
loadCarouselImageToView(
carouselView = carouselView,
imageViewId = R.id.den_carousel_portrait_left_image,
carouselItem = leftCarouselItem,
onComplete = {
// you can call notificationManager.notify for devices that could not show carousel image contents
}
)
loadCarouselImageToView(
carouselView = carouselView,
imageViewId = R.id.den_carousel_portrait_current_image,
carouselItem = currentCarouselItem,
onComplete = {
// you can call notificationManager.notify for devices that could not show carousel image contents
}
)
loadCarouselImageToView(
carouselView = carouselView,
imageViewId = R.id.den_carousel_portrait_right_image,
carouselItem = rightCarouselItem,
onComplete = {
// you can call notificationManager.notify for devices that could not show carousel image contents
}
)
val notification = NotificationCompat.Builder(context, channelId)
.setSmallIcon(R.mipmap.ic_launcher)
.setCustomContentView(collapsedView)
.setCustomBigContentView(carouselView)
.setContentIntent(contentPendingIntent)
.setDeleteIntent(deletePendingIntent)
.build()
// show message again silently with next, previous and current item.
notification.flags = Notification.FLAG_AUTO_CANCEL or Notification.FLAG_ONLY_ALERT_ONCE
// show message
val notificationManager = NotificationManagerCompat.from(context)
notificationManager.notify(
message.messageSource,
message.messageId,
notification
)
}