Cannot access '<init>': it is internal in 'TemplateRenderer' getting this error
NinadKisan opened this issue · comments
Ninad commented
implementation "com.clevertap.android:push-templates:1.2.0"
implementation "com.clevertap.android:clevertap-android-sdk:5.2.1"
Here is my code
try {
println("${message.data} ------- FirebaseMessagingService dATA")
try {
println("${JSONObject(message.data["pt_json"])} ------- FirebaseMessagingService dATA")
} catch (throwable: Throwable) {
println("Inside Push Templates $throwable")
}
println("${message.rawData} ------- FirebaseMessagingService raw")
println("${message.notification} ------- FirebaseMessagingService notification")
println("${message.messageId} ------- FirebaseMessagingService messageId")
println("Inside Push Templates")
val extras = Bundle()
for (entry in message.data.entries) {
extras.putString(entry.key, entry.value)
}
val info: NotificationInfo = CleverTapAPI.getNotificationInfo(extras)
if (info.fromCleverTap) {
if (extras.containsKey("pt_id")) {
println(" ------- FirebaseMessagingService 1")
var templateRenderer = TemplateRenderer(applicationContext, extras)
/* templateRenderer.renderNotification(
extras,
applicationContext,
NotificationCompat.Builder(applicationContext, "CTTestId"),
CleverTapInstanceConfig.createInstance(
applicationContext,
"",
""
),
12656312,
) */
} else {
println(" ------- FirebaseMessagingService 2")
CTFcmMessageHandler().createNotification(applicationContext, message)
}
}
} catch (throwable: Throwable) {
println("Inside Push Templates $throwable")
}
Shivam Sharma commented
Hi @NinadKisan
It seems that your custom rendering of CleverTap notifications is not implemented correctly. To render both Push Template notifications and Core notifications sent from CleverTap, please use the following method:
CTFcmMessageHandler().createNotification(getApplicationContext(), remoteMessage);
You can find further details in the Push Template doc and the Core Push handling doc for reference.