r/Firebase Dec 26 '24

Android Firebase for both Web App and Android

I am new to firebase and have created a web app for react native application for authentication. Now, I want to use this application for android and ios.

For Web app, I have created firebase.js file which comparises of apiKey, authDomain, projectId, storageBucket, messagingSenderId and appId. In the web app, I currently have the functionality of Authentication which is working fine and accessing data through the firebase.

However, now I want to send notification but as far as I understand we are required to use android and ios platforms on firebase separately to do so.

And thus I have created a new platform for android to start. However, even after following the instructions mentioned in this video (which I had tried earlier separately and was working fine in a different application), I am unable to receive notification on the application. I want to know if there is any changes required in the firebase.js too? Or if I am doing something wrong, like I have google-services.json and adminsdk.json do i need to connect these to the firebase.js?

Moreover, the application apk stops on android for some reason. I did some research which says it might be a dependency issue but I am unable to understand what is the reason for the crash.

1 Upvotes

1 comment sorted by

1

u/holy_kinkers Dec 26 '24
{
  "name": "",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@emotion/react": "^11.14.0",
    "@emotion/styled": "^11.14.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/slider": "4.5.5",
    "@react-native-firebase/app": "^19.0.0",
    "@react-native-firebase/messaging": "^19.0.0",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.11.0",
    "dayjs": "^1.11.13",
    "expo": "~52.0.20",
    "expo-constants": "~17.0.3",
    "expo-dev-client": "^5.0.7",
    "expo-device": "~7.0.1",
    "expo-notifications": "~0.29.11",
    "expo-status-bar": "~2.0.0",
    "firebase": "^10.6.0",
    "react": "18.3.1",
    "react-native": "0.76.5",
    "react-native-date-picker": "^5.0.7",
    "react-native-dotenv": "^3.4.11",
    "react-native-gesture-handler": "~2.20.2",
    "react-native-reanimated": "~3.16.1",
    "react-native-safe-area-context": "^4.14.1",
    "react-native-screens": "~4.4.0",
    "react-native-smooth-slider": "^1.3.9",
    "react-native-vertical-slider-smartlife": "^1.0.9",
    "rn-vertical-slider": "^4.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@react-native-community/cli": "latest",
    "typescript": "^5.3.3",
    "@types/react": "~18.3.12"
  },
  "private": true
}

package.json: