Code Monkey home page Code Monkey logo

flutter-fcm's Introduction

Flutter FCM Push Notification

A Flutter sample app for demonstrating how to handle firebase push notifications in the background and foreground.

Screenshots

Notification while the app is running in the background and handle navigation:

Notification while the app is running in the foreground and handle navigation:

Plugins

The Flutter plugins used in this project are as follows:

Add the following to your pubspec.yaml file:

  cupertino_icons: ^1.0.2
  firebase_messaging: ^14.2.5
  firebase_analytics: ^8.0.2
  flutter_local_notifications: ^13.0.0
  firebase_core: ^2.7.0

Usage

In order to run this project, you have to follow the steps below:

  1. Clone the project:

    git clone https://github.com/patoliavishal/flutter-FCM.git
  2. Complete Firebase project setup for both Android & iOS platforms by going to the Firebase console.

  3. For Android, replace your google-services.json file with an existing file.

    android -> app -> google-services.json
  4. For running on iOS, you have to do some configurations from Xcode. Follow the guide here.

  5. Get Flutter packages:

    flutter pub get
  6. Run the app:

    flutter run

If my example really helpful to you then please don't forgot to press Star icon.

Sent Notification Using Postman

URL:

   https://fcm.googleapis.com/fcm/send

Method:

   POST

Header:

   "Content-Type": "application/json",
   "Authorization": "key=<Server_key>"

Body:

   {
     "to": "/topics/flutter-notification",
     "notification": {
       "body": "Test Push Notification",
       "title": "Push Notification",
       "redirect": "product"
     },
     "data": {
       "title": "Push Notification",
       "message": "Test Push Notification",
       "redirect": "product"
     }
   }

Refer http-server-ref for more help.

License

Copyright (c) 2023 Vishal Patolia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contributing to Flutter FCM Push Notification

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create New Pull Request

flutter-fcm's People

Contributors

patoliavishal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.