GithubHelp home page GithubHelp logo

shweta-7span / flutter_push_notification Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 277 KB

Add project

Java 0.28% Swift 2.84% Objective-C 0.07% Dart 15.07% CMake 34.29% C++ 41.45% C 2.60% HTML 3.41%

flutter_push_notification's Introduction

FCM Push Notification

Create project in Firebase

  • Set up a Firebase project in the Firebase Console
  • Add your Android and/or iOS apps to the Firebase project and download the google-services.json and/or GoogleService-Info.plist files for each app.

Firebase Configuration

For help getting started with FCM Push Notification in Flutter visit the below link to configure Firebase in Flutter project. Add Firebase to your Flutter app

  1. Install Firebase CLI in mac Run following command curl -sL https://firebase.tools | bash

  2. Log into Firebase using your Google account by running the following command: firebase login

  3. Install the FlutterFire CLI by running the following command from any directory: dart pub global activate flutterfire_cli

    Note: If "zsh: command not found: dart" add flutter sdk path in .zshrc file

  4. From your Flutter project directory, run the following command to start the app configuration workflow: flutterfire configure

    Note: If "zsh: command not found: flutterfire" add this in .zshrc file

    After the configuration successfully completed, you can fine the Firebase configuration file in "lib/firebase_options.dart".

  5. Add the below dependencies flutter pub add firebase_core flutter pub add firebase_messaging flutter pub add flutter_local_notifications

Send Push Notification from Postman

Add the below part in the body and use POST method for 'https://fcm.googleapis.com/fcm/send' URL

{
  "to": "<device_Token>",
  "data": {
    "title": "App Testing",
    "body": "First Notification",
    "type": "1",
    "click_action": "Hellowww",
  },
  "android": {
    "priority": "high"
  },
  "notification": {
    "title": "Noti_title",
    "body": "Noti_body",
    "sound": "default"
  }
}

In Header add the below

Authorization: key= Content-Type: application/json

To get device_token use below code FirebaseMessaging.instance.getToken()

To get Firebase Server key, you need to follow these steps:

  • Go to the Firebase console and select your project.
  • Click on the gear icon in the top left corner and select "Project settings".
  • In the "Project settings" page, click on the "Cloud Messaging" tab.
  • In the "Project credentials" section, locate the "Server key" and copy the value.

flutter_push_notification's People

Contributors

shweta-7span avatar

Watchers

 avatar

Forkers

ruchit-7span

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.