This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"expo": { | |
"android": { | |
"googleServicesFile": "./google-services.json" | |
}, | |
"ios": { | |
"googleServicesFile": "./GoogleService-Info.plist" | |
}, | |
"plugins": [ | |
"@react-native-firebase/app", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"expo": { | |
"android": { | |
"googleServicesFile": "./google-services.json" | |
}, | |
"ios": { | |
"googleServicesFile": "./GoogleService-Info.plist" | |
}, | |
"plugins": [ | |
"@react-native-firebase/app", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const message = { | |
notification: { | |
title: 'New Notification', | |
body: 'This is a new notification', | |
}, | |
token: 'DEVICE_TOKEN', | |
}; | |
admin.messaging().send(message).then((response) => { | |
console.log('Successfully sent message: ', response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require('firebase-admin'); | |
const serviceAccount = require('path/to/serviceAccountkey.json'); | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save firebase-admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import messaging from '@react-native-firebase/messagig'; | |
// Handle incoming notifications when app is in foreground | |
messaging().onMessage(async (remoteMessage) => { | |
console.log('Received foreground notification: ', remoteMessage); | |
}); | |
// Handle incoming notifications when app is in background | |
messaging().onNotificationOpenedApp(async (remoteMessage) => { | |
console.log('Received background notification: ', remoteMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import messaging from '@react-native-firebase/messagig'; | |
messaging().getToken().then((token) => { | |
console.log(token); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install @react-native-firebase/app @react-native-firebase/messaging |