fluttergoogle-cloud-messagingapple-push-notificationsdeviceid

How to register GCM and APNS, get the DeviceId and send to it my API for database storage?


How do I register my Flutter app on GCM and APNS, receive the DeviceID and send it to my .NET API for database storage?

I need to send push notifications to iOS- and Android devices. But I do not know how to register the Flutter app to GCM and APNS and receive the DeviceID that my .NET API will store and use to send the push notifications.

Expected steps:

  1. Register Flutter app to GCM and APNS on app launch.
  2. Receive the DeviceID from GCM/APNS in Flutter and then pass it on to my .NET API.
  3. The API saves the DeviceID in database so it can later be used to send push notifications to that specific device.

Solution

  • I will use FCM. First I wanted to make push notifications without being dependent on FCM or similar services. But I think that's too time consuming and hard to solve, if not impossible with all rules on iOS and Android.