Updating FCM Key (Firebase Cloud Messaging)

● Get FCM Key used to push notification into different types of Web Application, Mobile Application.

● Follow the link to create FCM https://console.firebase.google.com

● Create the project and create both driver and rider app

● Update the Firebase RealTime Database Rules.

● Click setting in selected app

● Download the GoogleService-Info.plist from firebase console

Note: Use same FCM key in web, android and iOS also.

Update Rules like below :

{
  "rules": {
    ".read": "true",
    ".write": "true"
  }
}

Or

{
"rules": {
"live": {
"live_tracking": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
// UID must match logged in user and is fixed once set
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"Notification": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$user_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"driver_rider_trip_chats": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"trip": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"trip_request": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"GeoFire": {
".read": "auth.uid != null",
".write": "auth.uid != null",
".indexOn": "g",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
}
},
"demo": {
"live_tracking": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"Notification": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$user_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"driver_rider_trip_chats": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"trip": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"trip_request": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
},
"GeoFire": {
".read": "auth.uid != null",
".write": "auth.uid != null",
".indexOn": "g",
"$trip_id": {
"uid": {
".validate": "(data.exists() && data.val() == newData.val()) || newData.val() == auth.uid"
},
}
}
}
}
}

Steps To update FCM Key

  1. Open the Source folder

  2. And then open project folder (Cabme)

  3. Now to place / replace the GoogleService-Info.plist file Paste API key in Xcode Project

Last updated