takiuddin93 / ChatApp

A Flutter Chat application, using Firebase for Google Sign In/Sign Up and exchange text, emoji and images. Integrated Agora Video Call SDK to communicate over video call
MIT License
104 stars 23 forks source link

direct implementation of group chats and push notification #4

Closed Milimeter closed 3 years ago

Milimeter commented 4 years ago

i have previously been following Ronak's tutorial so i want to get some code here and add it to my version. so my question is that: 1). is the group chat functionality implementation complete 2). the push notification of the messages, does it need any extra configuration from the firebase console.

those are the two implementation that i would like for you to address

Milimeter commented 4 years ago

wow man.... you seem to have implemented voice calls too.

Milimeter commented 4 years ago

wow man.... you seem to have implemented voice calls too.

takiuddin93 commented 4 years ago

i have previously been following Ronak's tutorial so i want to get some code here and add it to my version. so my question is that: 1). is the group chat functionality implementation complete

no, I haven't yet implemented that.

2). the push notification of the messages, does it need any extra configuration from the firebase console.

entirely basic configuration of firebase notification. only thing I did is use notification url and fire an http requests when you click the message send button.

those are the two implementation that i would like for you to address

Milimeter commented 4 years ago

does the push notification actually work

Milimeter commented 4 years ago

if you are looking for group chat then you should check out "ahmedgulabkhan" on github. he developed the group chat fuctionability

takiuddin93 commented 4 years ago

does the push notification actually work

I have implemented it..and tested it multiple times..it worked every time..so yes, it works.. you can try it and let me know if it doesn't work..will help fixing it..

Milimeter commented 4 years ago

i have implemented your push notification code and logic in my version of the app so my other question is that did you do any other settings from the firebase console apart from copying the server key

takiuddin93 commented 3 years ago

i have implemented your push notification code and logic in my version of the app so my other question is that did you do any other settings from the firebase console apart from copying the server key

sorry for the late reply.

No other configs other than copying server key. And this is the code just in case.

Future<http.Response> sendNotification(
      String message, String sender, String receiver) {
    print("Firebase Token: " + receiver);
    return http.post(
      'https://fcm.googleapis.com/fcm/send',
      headers: <String, String>{
        'Authorization': 'key=$SERVER_KEY',
        'Content-Type': 'application/json; charset=UTF-8',
      },
      body: jsonEncode(<String, dynamic>{
        // "message": {
        "to": "$receiver",
        "collapse_key": "type_a",
        "priority": "high",
        "notification": {
          "title": "$sender",
          "body": "$message",
        },
        "data": {
          "title": "$sender",
          "body": "$message",
          "sound": "default",
          "click_action": "FLUTTER_NOTIFICATION_CLICK",
        }
        // }
      }),
    );
  }
Milimeter commented 3 years ago

how do i get the server key. please tell me

takiuddin93 commented 3 years ago

how do i get the server key. please tell me

in Firebase go to your project and go in to "Project Settings" then select "Cloud Messaging".

There you will get your Server Key.

takiuddin93 commented 3 years ago

how do i get the server key. please tell me

Did you get it? I'll close the issue soon!