Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

Flutter and push notifications

Avatar

Level 1

 

Hi, I understand that we can implement push notifications with AJO for a Flutter mobile app. However, the documentation isn’t very clear to me.

 

From what I’ve read, it seems that we don’t need native code to initialize the SDK, but we do need to add some native code to pass the Firebase token, for example on Android:

MobileCore.setPushIdentifier(token);
 

After that, we should be able to listen for messages in Flutter using something like:

List<Message> messages = await Messaging.getCachedMessages();
 

Is my understanding correct? I’d really appreciate some guidance on this.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Employee Advisor

Flutter wrapper doesn’t expose MobileCore.setPushIdentifier(token) directly. So you have to Fetch the Firebase token in the native Android/iOS code Call MobileCore.setPushIdentifier(token); from native code and not directly from Flutter. @NestorAr  After initializing things natively, the messages should be delivered to the app via Firebase/FCM or APNs.
something like this:

FirebaseMessaging.getInstance().getToken() .addOnCompleteListener(new OnCompleteListener<String>() { @Override public void onComplete(@NonNull Task<String> task) { if (task.isSuccessful()) { String token = task.getResult(); MobileCore.setPushIdentifier(token); } } });

sample repo for flutter: https://github.com/adobe/aepsdk_flutter/tree/main

Avatar

Level 1

Ok perfect, I understand the part about initialization and the push notifier.

Regarding the messages, if I already have FCM implemented for push notifications in my app, does that mean I’m already set to receive AJO notifications as a RemoteMessage from FirebaseMessaging? Or do I also need a native implementation to handle these new messages from AJO?

Thank you very much for your help.

Avatar

Employee Advisor

@NestorAr I think you should receive the notification with FCM implemented, let us know if you face any issue I will check with our mobile team.