Flutter Push Notification Tutorial

339 views
Skip to first unread message

Sundaravel M

unread,
Jul 4, 2019, 2:03:33 AM7/4/19
to Flutter Development (flutter-dev)
Hello Everyone,

I have spent a few hours to explore Firebase Messaging with Flutter. & Finally integrated with success. I decided to share my knowledge & code about integrating FCM with Flutter with Video tutorial


Rabih M. ElBaba (Gmail)

unread,
Jul 4, 2019, 3:51:10 AM7/4/19
to Sundaravel M, Flutter Development (flutter-dev)
does it support opening the article details if the application is closed and swiped?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/3846876c-e172-474b-8c26-55de08b88cd5%40googlegroups.com.

Sergio Ruiz

unread,
Jul 12, 2019, 8:39:27 AM7/12/19
to Flutter Development (flutter-dev)
amazing work

Ian Perera

unread,
Nov 7, 2019, 10:31:11 AM11/7/19
to Flutter Development (flutter-dev)
thanks for this, I'll be sure to look at it, but is there away to use push notification without utilizing FCM.  I already have my backend and would like to integrate there.

Sam Cromer

unread,
Nov 7, 2019, 10:53:01 AM11/7/19
to Ian Perera, Flutter Development (flutter-dev)

I use FCM without using a firebase DB, I just make the http calls in my app and use my MS SQL database for the backend. I can share code with you if you like it works well for us.

 

Sent from Mail for Windows 10

--

You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Ian Perera

unread,
Nov 8, 2019, 8:14:34 AM11/8/19
to Flutter Development (flutter-dev)
Sam

if you can that would be awesome. 

thanks


On Thursday, November 7, 2019 at 10:53:01 AM UTC-5, Sam Cromer wrote:

I use FCM without using a firebase DB, I just make the http calls in my app and use my MS SQL database for the backend. I can share code with you if you like it works well for us.

 

Sent from Mail for Windows 10

 

From: Ian Perera
Sent: Thursday, November 7, 2019 9:31 AM
To: Flutter Development (flutter-dev)
Subject: Re: Flutter Push Notification Tutorial

 

thanks for this, I'll be sure to look at it, but is there away to use push notification without utilizing FCM.  I already have my backend and would like to integrate there.

On Thursday, July 4, 2019 at 2:03:33 AM UTC-4, Sundaravel M wrote:

Hello Everyone,

 

I have spent a few hours to explore Firebase Messaging with Flutter. & Finally integrated with success. I decided to share my knowledge & code about integrating FCM with Flutter with Video tutorial

 

 

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.

To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Sam Cromer

unread,
Nov 8, 2019, 12:12:24 PM11/8/19
to Ian Perera, Flutter Development (flutter-dev)

Sorry for the late reply here it is:

 

This sends a push notification via FCM

 

import 'dart:async';

import 'dart:convert';

import 'package:http/http.dart' as http;



 

 Future<voidsendPushNotificationByToken(String body, String token, String title) async {

 

 // TO DO - write token to DB

 

 

  final response =

      await http.post('https://fcm.googleapis.com/fcm/send',

      headers: {"Content-Type""application/json"

                 'Accept''application/json',

                 'Authorization'"key=AAAAja7qRO0:APA91bHjO6NMXTHlU-VDOE_g-8eIHULnvbKbpIOVwjwc7s7wyr3AOGxfm7ddtpDZL_2oJvSL6hrT9t6p-LdVWUpLGxS4stxUugsItQGv9aca0DbSDPiLZ_7HV5821Z0ypXcYZkD20vXd5-MWHBKVh1rddhDE-x6V7g"},

      body: json.encode({'to' : token , 

       "notification": {"body": body, "title": title},

       }

       ));

 

  if (response. statusCode == 200) {

    // If the call to the server was successful, parse the JSON

    print("success");

 

  } 

  else {

    // If that call was not successful, throw an error.

   throw Exception('Send Failed');

  }

 }

 

 

Feel free to ask any questions you may have, I couldn’t find much on this so I threw it together.

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/8d48830c-0f33-42f2-837e-5dcc14570203%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages