Closed thiaagodev closed 1 month ago
Hey there, Thiago. Sorry that you expired this issue and thank you very much for reporting it t us.
Luckily, the stacktrace is helpful. It looks like you have sent a push notification to a device with an image attached. The code throws an error because the URL to the image does not contain a protocol.
I am going to guess that the image URL in the push composer in fly.customer.io does not contain https://
or http://
at the beginning of it. Could you verify this by sending us an example of a push notification you have composed that caused this issue when you sent it to a device?
The SDK should be able to handle this situation without encountering an error so we will be sure to fix the code. In the meantime, as a workaround, if you make sure to add https://
to the image URL in fly.customer.io, does this fix your issue when you send the push to the device?
Hi @levibostian , thank you for response.
In fact, the push notification I sent did not have any image attached, just the title, message and a deeplink, i was intercept the message in debug and the field image was empty.
My implementation:
FirebaseMessaging.onMessage.listen((event) async {
try {
CustomerIO.messagingPush().onMessageReceived(event.toMap()).then(
(handled) {
if (handled) {
saveNotification(event);
}
},
);
} catch (_) {}
});
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
try {
CustomerIO.messagingPush()
.onBackgroundMessageReceived(message.toMap())
.then(
(handled) {
if (handled) {
saveNotification(message);
}
},
);
} catch (_) {}
}
And an observation, despite the error, the message was displayed successfully and handled returns true, but I have ANRs in the play console with this coroutine blocking io.customer.messagingpush.CustomerIOPushNotificationHandler.addImage
Thank you for those additional details. Very helpful!
The addImage
function that you mention (and the stacktrace shows) should only be called when the push notification payload has a image key in the JSON.
Could you send me the push notifications that caused this issue? I am looking for https://fly.customer.io
URLs for the push notification you created and used to send the push to the device.
How can i send?
Feel free to send an email to win@customer.io
instead of this public github issue. Be sure in your email to reference this github issue so the message gets directed to our team.
Ok, i will send
SDK version: ^1.4.0
Environment: Development
D/[CIO] (24882): Received duplicate message with deliveryId: dgTe6QYABQAAAY94LLGHx3vHJYy4GbK5BQ== W/System.err(24882): java.net.MalformedURLException: no protocol: W/System.err(24882): at java.net.URL.(URL.java:601)
W/System.err(24882): at java.net.URL.(URL.java:498)
W/System.err(24882): at java.net.URL.(URL.java:447)
W/System.err(24882): at io.customer.messagingpush.CustomerIOPushNotificationHandler$addImage$1.invokeSuspend(CustomerIOPushNotificationHandler.kt:251)
W/System.err(24882): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err(24882): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
W/System.err(24882): at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
W/System.err(24882): at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
W/System.err(24882): at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking(Builders.kt:59)
W/System.err(24882): at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
W/System.err(24882): at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking$default(Builders.kt:38)
W/System.err(24882): at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
W/System.err(24882): at io.customer.messagingpush.CustomerIOPushNotificationHandler.addImage(CustomerIOPushNotificationHandler.kt:247)
W/System.err(24882): at io.customer.messagingpush.CustomerIOPushNotificationHandler.handleNotification(CustomerIOPushNotificationHandler.kt:174)
W/System.err(24882): at io.customer.messagingpush.CustomerIOPushNotificationHandler.handleMessage(CustomerIOPushNotificationHandler.kt:110)
W/System.err(24882): at io.customer.messagingpush.CustomerIOFirebaseMessagingService$Companion.handleMessageReceived(CustomerIOFirebaseMessagingService.kt:109)
W/System.err(24882): at io.customer.messagingpush.CustomerIOFirebaseMessagingService$Companion.onMessageReceived(CustomerIOFirebaseMessagingService.kt:31)
W/System.err(24882): at io.customer.customer_io.messagingpush.CustomerIOPushMessaging.onMessageReceived(CustomerIOPushMessaging.kt:67)
W/System.err(24882): at io.customer.customer_io.messagingpush.CustomerIOPushMessaging.access$onMessageReceived(CustomerIOPushMessaging.kt:21)
W/System.err(24882): at io.customer.customer_io.messagingpush.CustomerIOPushMessaging$onMethodCall$1.invoke(CustomerIOPushMessaging.kt:35)
W/System.err(24882): at io.customer.customer_io.messagingpush.CustomerIOPushMessaging$onMethodCall$1.invoke(CustomerIOPushMessaging.kt:34)
W/System.err(24882): at io.customer.customer_io.CustomerIOExtensionsKt.invokeNative(CustomerIOExtensions.kt:29)
W/System.err(24882): at io.customer.customer_io.messagingpush.CustomerIOPushMessaging.onMethodCall(CustomerIOPushMessaging.kt:34)
W/System.err(24882): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
W/System.err(24882): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
W/System.err(24882): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
W/System.err(24882): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
W/System.err(24882): at android.os.Handler.handleCallback(Handler.java:942)
W/System.err(24882): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(24882): at android.os.Looper.loopOnce(Looper.java:201)
W/System.err(24882): at android.os.Looper.loop(Looper.java:288)
W/System.err(24882): at android.app.ActivityThread.main(ActivityThread.java:7872)
W/System.err(24882): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(24882): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
W/System.err(24882): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)