Web development basic and advance tutorial, php basic tutorial, laravel basic tutorial, React Native tutorial

Tuesday, May 24, 2022

expo push notification with firebase

0 comments

expo push notification with firebase

In this tutorial i will explain how you will create expo push notification using firebase.

this is super easy to do. follow me in step by step. if you are new in my blog Subscribe to my channel and Follow me in facebook and my last working website is love4you2.

 Start with Step by Step process :

1. Create New Project

2. Create Firebase Account.


and look at the work flow of image. which one we are going to do.


 After Creating Firebase account 

 

 download this google-service.json file put the file in root directory of expo

Firebase Cloud Messaging is required for all managed and bare workflow Android apps made with Expo, unless you’re still running your app in the Expo client. To set up your Expo Android app to get push notifications using your own FCM credentials, follow this guide closely.Note that FCM is not currently available for Expo iOS apps.

Setup Google Services

  1. If you have not already created a Firebase project for your app, do so now by clicking on Add project in the Firebase Console.
  2. In your new project console, click Add Firebase to your Android app and follow the setup steps. Make sure that the Android package name you enter is the same as the value of android.package in your app.json      
  3.       

                                                      
    Download the google-services.jsonfile and place it in your Expo app’s root directory.
  4.  
  5.  

     

    In your app.json, add an android.googleServicesFile field with the relative path to the google-services.json file you just downloaded. If you placed it in the root directory, this will probably look like

    {
      ...
      "android": {
        "googleServicesFile": "./google-services.json",
        ...
      }
    }
    

    Finally, make a new build of your app by running expo build:android

    We recommends you use the latest version of the node module long term version, if you use another version, the push notification will not work.

    Current active node long term version is v12, mine is node v12.18.3 (npm v6.14.7)

     

    Uploading Server Credentials

    In order for Expo to send notifications from our servers using your credentials, you’ll need to upload your secret server key. You can find this key in the Firebase Console for your project:

    1. At the top of the sidebar, click the gear icon to the right of Project Overview to go to your project settings (1).
    2. Click on the Cloud Messaging tab in the Settings pane (2).
    3. Copy the token listed next to Server key (3).
    4. Run expo push:android:upload --api-key <your-token-here>, replacing <your-token-here> with the string you just copied. 


     

     

     


                                                 

No comments:

Post a Comment