cometchat / cometchat-sample-app-flutter

Voice & Video Calling and Text Chat App for Flutter
https://www.cometchat.com
Other
30 stars 28 forks source link

Need Push notification setup document #8

Closed HareshIndiaNIC closed 1 year ago

HareshIndiaNIC commented 1 year ago

Describe the problem

Didn't find any documentation regarding setup push notification in Flutter.

cometchat-helpcenter-bot commented 1 year ago

Keagan Ellis (CometChat Team) replied:

Hey,

Thanks for reaching out with your concern. I am Keagan from the Support team.

We do not have the documentation for push notification integration with flutter. However, it is possible to integrate push notifications.

I am looping in our Solutions team to share some more information on how you can integrate push notifications using Flutter.

Regards.

Keagan Ellis CometChat

HareshIndiaNIC commented 1 year ago

Thanks, waiting for more information regrading the push notification.

cometchat-helpcenter-bot commented 1 year ago

Aditya (CometChat Team) replied:

Hello Haresh,

Unfortunately, we do not have the docs ready for the same. We are working on the same and the docs will be live soon.But you can achieve the same using the below steps:

  1. Install FIrebase CLI
  2. Add Firebase to your Flutter app - This Asks you to select the platforms (iOS, Android) supported in your Flutter app. For each selected platform, the FlutterFire CLI creates a new Firebase app in your Firebase project.

You can select either to use an existing Firebase project or to create a new Firebase project. If you already have apps registered in an existing Firebase project, the FlutterFire CLI will attempt to match them based on your current Flutter project configuration.

  1. Log in to the CometChat Dashboard and select the app you want to set up the push notifications tab.
  2. Head over to the Extensions tab and then enable the push notifications extension.
  3. Click on the settings icon to open the settings for the extension
  4. Provide the Firebase server key. This can be found in the Cloud Messaging section in the Firebase Dashboard.

Once the settings are correctly configured, the Push Notifications extension will start sending push notifications for all the messages shared across in your app. Please make sure that you select both Android and iOS platforms while configuring the extension.

One the client end, please follow the below steps:

  1. Add Following Dependencies to your flutter project:

a) firebase_messaging b) firebase_core

  1. Obtain the firebase token for the logged in user and provide it to CometChat. You can do this as follows:

FirebaseMessaging messaging = FirebaseMessaging.instance; final String? fcmToken = await messaging.getToken(); if (fcmToken != null) { CometChat.registerTokenForPushNotification(fcmToken, onSuccess: (_) { print("registration Successful"); }, onError: (CometChatException e) { print("${e.details}"); });}

  1. Also register listener to be called when fcmToken is refreshed FirebaseMessaging.instance.onTokenRefresh.listen((fcmToken) { CometChat.registerTokenForPushNotification(fcmToken, onSuccess: () { print("registration Successful"); }, onError: () { print("error"); });}).onError((err) { // Error getting token.});

  2. Create a onMessage listener to Firebase messaging which will give you events on every message received.

Hope this helps. Please do let us know in case you face any difficulties. We will be happy to help you in case any roadblocks are encountered.

I am also forwarding this request to our product team Here is what you can expect:

Rest assured we will read your request, but we may not respond Our Product Managers dedicate time each week to read your requests, answer your questions, ask you questions about your feedback, and lead conversations around areas they’re focused on. That said, we simply can't respond to everything. Requests are not guaranteed a response or inclusion in any product backlogs or roadmaps.

We don’t share timelines Occasionally, we’ll share very general ideas of what is or isn’t on a roadmap, or roughly when you might expect to see something roll out. However, we do not share specific dates. While we are as upfront as we can be, our roadmap is full of projects and we generally don’t provide timelines for new features or changes.

Thanks

Aditya Gokula CometChat

kunhokimcareerday commented 1 year ago

Hello any updates on this?