Push Notification

To setup push notification, you need to follow the below steps:

1. Configuring schema in admin panel
Open classified listing > settings > app . Now put a same value for the app under App schema. (only lowercase alphabets)

2. Configuring schema in app.json
You need to open your app.json file and add a custom url schema under schema key. See the image.

3. Configuring firebase app

  1. (If you already configured google login, and added google-services.json file, go to step 4)
    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. And similarly add iOS project.



    (Android only) Go to your Firebase project’s settings, scroll down to “Your apps” and select your Android app. Under SHA certificate fingerprints, click Add fingerprint, and add Google Certificate Fingerprint.
    You’ll get Google Certificate Fingerprint by following steps:
    (You need to build your app once before these steps to generate credentials)
    – run eas credentials
    – Select Android
    – Select profile (production)
    – You’ll get all the credentials in the console. From here copy the “SHA1 Fingerprint“. This SHA1 Fingerprint is Google Certificate Fingerprint.
    *** If you haven’t already run eas build -p android for this project, you’ll need to do that first before getting the Google Certificate Fingerprint.
  3. Download the google-services.json  for android and Googleservice-info.plist file for iOS and place it in your app’s root directory.

  4. 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 . Similarly do for iOS. see below code.
{
  ...
  "ios" : {
    "googleServicesFile": "./GoogleService-Info.plist"
    ...
  }
  ...
  "android": {
    "googleServicesFile": "./google-services.json",
    ...
  }
}

4. 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. Click the gear icon to the right of Project Overview to go to your project settings.

  2. Click on the Cloud Messaging tab in the Settings pane.
  3. Copy the token listed next to Server key.




    Note : If you see Cloud Messaging API (Legacy) is disabled, just click the three dot right next to it and select “Manage API in Google Cloud Console” and After going to cloud console, Click “Enable”. Come back to this page again and refresh it. You’ll see the server key.

  4. Now Log in to expo.dev . Select your app from left sidebar. Click on “Credentials” from Left sidebar

    =>

    – Select Android and then Select “Applocation Identifier name”



    – Now screooll down to “FCM Server Key” section and click on “Add a FCM Server Key” Button



    – Now Select “Google Cloud Messaging Token” and paste the copied Server key under Cloud Messaging Token” and click “Save” button


5. Finally go to app > services > miscConfig.js and put “true” for “enablePushNotification”



That’s it — users who run this new version of the app will now receive notifications through FCM using your project’s credentials.

– After configuring Push notification , please create a new build and test with that. Older build might produce errors.

6. After you upload the app in play store and get approved, you need to log in to your play console account and select your published app. On the next page select “App Signing” under “Setup” option from the left sidebar. Scroll down to “App signing key certificate” You’ll see something like the image below. Copy the “SHA-1 certificate fingerprint” under “App signing key certificate”.
Go to your firebase project, open the android app you created in step 2. Now add the “SHA-1 certificate fingerprint” to your project.
Similarly Copy the “SHA-256 certificate fingerprint” And add it to firebase project.
If you miss this step, google signin will not work in the app downloaded from play store.