해당 기능은 노티플라이 Android SDK 1.16.1 이상 버전부터 지원됩니다.
package com.your.project
import android.app.Application
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import tech.notifly.Notifly
import tech.notifly.push.interfaces.IInAppMessageEventListener
class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize Notifly SDK
Notifly.initialize(
context = applicationContext,
projectId = BuildConfig.NOTIFLY_PROJECT_ID,
username = BuildConfig.NOTIFLY_USERNAME,
password = BuildConfig.NOTIFLY_PASSWORD,
)
// Add Notifly in-app message event listener
Notifly.addInAppMessageEventListener(
object : IInAppMessageEventListener {
override fun handleEvent(
eventName: String,
eventParams: Map<String, Any?>?,
) {
Log.d("SampleApplication", "InAppMessage event dispatched: $eventName, $eventParams")
}
},
)
}
}