aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.31k stars 243 forks source link

Flutter Amplify Push Notification. Can't send push message in IOS via Amazon Pinpoint FCM #5451

Open gigamike opened 6 days ago

gigamike commented 6 days ago

Description

Hello,

The Flutter Amplify Docs is not very helpful. I don't know if this is a bug or if we can't send push notifications to iPhone/IOS using Amazon Pinpoint. Based on Amazon Pinpoint

"Firebase Cloud Messaging (FCM) – For sending messages to Android devices and web apps. It can also be used to send messages to iOS devices."

So via FCM we can send both Android and IOS.

But when I calling this

Amplify.Notifications.Push.onTokenReceived.listen((event) { print('🚀 onTokenReceived $event'); });

it generates an invalid FCM device ID, it generates an APN device ID that works on APN.

Any Ideas that when sending push notifications to IOS it's always APN and for Androis its FCM or do we need some APN to FCM device ID converter?

Thanks in advance

Categories

Steps to Reproduce

I just followed Amplify Docs

Screenshots

Screenshot 2024-09-13 at 2 19 36 PM

Platforms

Flutter Version

3.24.1

Amplify Flutter Version

2.2.0

Deployment Method

Amplify Gen 2

Schema

No response

tyllark commented 5 days ago

Hello @gigamike, I'm sorry but iOS Amplify only supports APN currently and thus will only generate APN tokens from onTokenReceived. We have a guides for setting up APN and for connecting it to Pinpoint. Please let me know if you have any other questions, otherwise Ill keep this issue open as a feature request for FCM support for iOS.

To avoid additional confusion in the future, iOS push notifications will use APN Sandbox unless you install the app via the App Store, Tesflight, or directly from an ipa.

gigamike commented 3 days ago

Thanks for the reply @tyllark , now makes sense. Hopefully, someday Amplify Push Notification FCM support for iOS.