Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Push Notification callbacks in the Dart layer #14

Closed
CassiusPacheco opened this issue Jan 11, 2022 · 19 comments
Closed

[Feature]: Push Notification callbacks in the Dart layer #14

CassiusPacheco opened this issue Jan 11, 2022 · 19 comments

Comments

@CassiusPacheco
Copy link

Hello,

as far as I understand there's currently no way of getting callbacks for when Braze receives a push notification. We want to implement some custom code and routing based on the data.

Similar to setBrazeInAppMessageCallback and setBrazeContentCardsCallback that you have implemented.

Another example is Firebase Messaging exposes streams for all types of notifications received.

@hokstuff
Copy link
Collaborator

Hi @CassiusPacheco,

Thanks for filing this and adding information about other resources. Currently, we support push notifications on Flutter via the native layer. This means that in order to respond to run custom code once Braze receives a push notification, you would need to add code into your native iOS and Android parts of your Flutter app as described in the docs.

Let me know if this helps or if you have any other concerns!

@CassiusPacheco
Copy link
Author

Hey @hokstuff, thanks for coming back to me.

I'm aware I would have to write it myself, in fact I had to do it in order to solve my problem, however it'd be best if your lib did it, since, in my opinion, a Push Notification library is responsible for offering callbacks for it, like Firebase does.

Honestly had I known of this limitation before I would have voted against using Braze in favour of Firebase.

Anyway, I leave my feedback to you. Feel free to close the issue.

Thanks

@hokstuff
Copy link
Collaborator

Hi @CassiusPacheco,

Thanks for your feedback about this. We currently do have a product request to move any logic from the native layers into the Dart layer to make integrating our Flutter SDK as frictionless as possible, and that includes any code around push. Thank you for your suggestion - we have added the details of this thread to our internal request.

Thanks!

@RTodorov
Copy link

Hello @hokstuff . Given the Flutter plugin is still using SDK 17, I understand Flutter is not really a priority for Braze, is that correct?

@hokstuff
Copy link
Collaborator

Hi @RTodorov,

The Flutter SDK is a priority at Braze and we have several exciting features planned and in development for the SDK. One thing to note is that not every native SDK update will make it into the Flutter SDK at the same time as the native counterparts, but we do make sure critical bugfixes and features releases are released right away.

We are working on prepping the next version of the SDK which will also update to use the Android SDK version. Thanks for your patience!

@julianfalcionelli
Copy link

Hi @hokstuff. The native notification implementation is not compatible with the way notifications are handled in Flutter.

FirebaseMessaging callbacks don't work correctly, and Background notifications (at least on Android), don't work if the native Braze Handler isn't implemented on Android, which is a problem, because we have to bypass/patch it to be able to use it in Flutter side.

I think this is because the Payload of the Braze notifications does not follow the standard defined by Firebase (if I am not wrong the notification property directly is not sent by the Braze API). Ref: https://firebase.google.com/docs/cloud-messaging/concept-options

Could you at least follow the defined standard? Currently it complicates the implementation with Flutter a lot.

I also don't understand why you don't send that property, since you are supporting Silent Notifications/ Data Notifications that sent everything in the Data property (without the notification property), so by default the Notification property should be there.

@radixdev
Copy link

Hi @julianfalcionelli ,

The core Android Braze SDK receives strictly data messages over Firebase since in many cases, a notification message is handled by Firebase (and not forwarded to the SDK) and displayed automatically. However to properly do things like analytics, deeplinking, etc. with the flexibility we need, Braze instead uses data messages and encodes the displayed content of the notification into the data portion as well. Thus, there is no "notification message" as Firebase defines it in the actual payload sent from Firebase, only the data message portion. There are data types, like push stories, inline image push, etc. that Firebase doesn't offer that Braze does so sending notification messages isn't viable. I hope this clears up that aspect of your question.

Thanks,
Julian

@julianfalcionelli
Copy link

julianfalcionelli commented Jun 16, 2022

@radixdev I fully understand that you have to intercept the notification so that certain functionalities such as analytics, attributions and others work correctly, but I do not understand why coupling the implementation to the notification rendering logic, you can capture the notifications and their information without having to take charge of visualizing them and follow the standard used by Firebase and other platforms.

@radixdev
Copy link

Hi @julianfalcionelli ,

Just to clarify, the desired API interface here would be that Braze would continue to handle the rendering logic but that the Flutter layer would get a stream of that notification information as it arrives? In that API interface, the integrator wouldn't have to touch native code, would receive the notification data, and would have all the benefits of the core Braze SDKs doing notification handling.

Is that correct?

@hokstuff hokstuff changed the title Missing callback for push notification [Feature]: Push Notification callbacks in the Dart layer Sep 29, 2022
@terrancej
Copy link

@radixdev We are running into this issue as well. The SDK currently gets the notification data into the native layer but it does not move the data into the Dart layer for us to use in Flutter. Thus leaving that gap for us to fill in with our own native code. It would be hugely beneficial for the SDK to support this.

@radixdev
Copy link

HI @terrancej ,

We're currently working on getting this ready and will update this issue with progress. Thank you for your patience.

@Kirill-Karmazin-IDT
Copy link

Kirill-Karmazin-IDT commented Jun 26, 2023

@radixdev @hokstuff While fixing this issue could you guys please share a sample of native code for a workaround meanwhile?

When we send our push notification from Braze we get null when the app was opened from the terminated state inFirebaseMessaging.instance.getInitialMessage()
and the stream FirebaseMessaging.onMessageOpenedApp doesn't work when the app was opened from the background.
When we send directly from FCM everything works as expected.

@hokstuff
Copy link
Collaborator

hokstuff commented Jul 7, 2023

Hi all,

Just to update this thread - Our team is working on a longer term solution around this feature request in each of the native Braze SDKs to create an API interface that can be easily used across all of our "wrapper" SDKs (e.g. Flutter, React Native, Unity, etc). We have had similar feature requests across each of these codebases and feel a more holistic approach would be best solution for consistency and maintenance. This also means that the solution will take some more time - thanks for your patience.


Hi @Kirill-Karmazin-IDT,

It sounds like the issue you are facing is specific to your setup while using both our SDK and a separate SDK (Firebase). We will need more information on your setup, and it seems to be a tangential topic than the original post. The workaround described above requires handling the push payload in each of the native layers. We currently don't have sample code around this but have that request on our roadmap.

For your specific situation, can you contact support@braze.com with your integration code and the specific issues you are facing? It would also be helpful to converse on a separate thread instead of this one since they have different topics.

Thanks!

@mark-buot
Copy link

Do we have an expected eta for when should we expect this release? From the time of writing it's been 8 months now

We're about to adopt braze via Flutter as well and would want to eliminate as much native code changes as possible

@hokstuff
Copy link
Collaborator

hokstuff commented Jan 25, 2024

Hi @mark-buot,

As an update - We have released this feature in our React Native SDK, and we have allocated work to implement the complementary feature on the Flutter SDK. At the moment, we are still planning out what this looks like and don't have a specific ETA for this. However, we are hoping to implement a solution within the quarter.

Thanks!

@Galti
Copy link

Galti commented Mar 18, 2024

Hello.
@hokstuff are you still hoping to implement this within the quarter?

@hokstuff
Copy link
Collaborator

Hi @Galti,

We currently have this feature planned for this half and are planning to start development on it shortly. We will keep this thread notified with any updates. Thanks for your patience!

@hokstuff
Copy link
Collaborator

hokstuff commented Apr 9, 2024

Hi @CassiusPacheco @RTodorov @julianfalcionelli @terrancej @Kirill-Karmazin-IDT @mark-buot @Galti,

I'm pleased to announce that we have released Braze Flutter SDK version 9.0.0 which adds an API to subscribe to Braze Push notification events directly in the Dart layer! If you have any further questions or comments about this feature, feel free to let us know on this thread or by contacting your CSM / our Support team.

Thank you all for your patience!

@hokstuff hokstuff closed this as completed Apr 9, 2024
@mark-buot
Copy link

Thank you @hokstuff we'll try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants