Open Neelansh-ns opened 1 month ago
Hi @Neelansh-ns ,
Thanks for reaching out! Here are some things you can try to help resolve your issue:
If you continue to run into issues, please contact our Support Team by emailing support@braze.com. They will be able to help with your specific integration. In your email, please include:
Thanks!
I'm able to solve this by adding a slight delay in the processPushNotificationEvent
function, as there is a race condition happening here. The BrazePushReceiver sends out click event as soon as the notification is tapped.
2024-06-25 02:32:53.655 12273-12273 Braze v30....shReceiver io.invideo.ai I Received broadcast message. Message: Intent { act=com.braze.action.BRAZE_PUSH_CLICKED cmp=io.invideo.ai/com.braze.push.BrazePushReceiver (has extras) }
2024-06-25 02:32:53.658 12273-12381 Braze v30.4.0 .Braze io.invideo.ai I Logging push click. Campaign Id: dGVzdF90ZXN0X2RpPTY2NzlkZWVjZGFlZWI4MzFlYjNmMGE0Yzc1YTVhN2Jj
And then the onAttachedToEngine
is called which initializes the BrazeSDK.
2024-06-25 02:32:53.843 12273-12273 Braze v30....razePlugin io.invideo.ai W Neelansh onAttachedToEngine
2024-06-25 02:32:53.843 12273-12273 Braze v30....razePlugin io.invideo.ai W Neelansh activeplugin added
By adding a few milliseconds delay in the processPushNotificationEvent, I get the correct notification payload on calling subscribeToPushNotificationEvents
from the dart side.
Please refer to this customized Plugin file, where I have added logs. I have used the approach of adding a delay of 200ms to validate the bug.
Adding the delay fixes the bug. https://gist.github.com/Neelansh-ns/2e862e3f7522d78081c99d0ee36d7f37
I've opened a PR for the same here, where I'm storing the pending events while an activity gets attached. Please review: #78
Actions performed:
App opened -> App sent to Inactive state by back press -> Notification sent -> Notification clicked to open the app.
These are the event logs:
PS: The Warning logs are added by me for debugging in the respective functions in the plugin.
How to receive the payload in the app, after the notification is tapped from inactive/terminated state. This works fine in iOS as I get the payload in the
subscribeToPushNotificationEvents
listener. The same is not happening in Android.From the logs, I can see that event is published before the activePlugin is set.