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 io.invertase.firebase.messaging.RNFirebaseMessagingPackage; | |
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; | |
public class MainApplication extends Application implements ReactApplication { | |
... |
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
dependencies { | |
// custom dependencies | |
// Firebase | |
implementation "com.google.android.gms:play-services-base:17.0.0" | |
implementation "com.google.firebase:firebase-core:17.0.1" | |
implementation "com.google.firebase:firebase-messaging:19.0.0" | |
} |
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 React, { Component, Fragment } from 'react'; | |
import firebase from 'react-native-firebase'; | |
class App extends Component<Props> { | |
... | |
getToken = async () => { | |
let fcmToken = await AsyncStorage.getItem('fcmToken'); | |
if (!fcmToken) { | |
fcmToken = await firebase.messaging().getToken(); |
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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
dependencies { | |
classpath("com.android.tools.build:gradle:3.4.1") | |
// ADD THIS LINE | |
classpath 'com.google.gms:google-services:4.2.0' | |
} | |
} |
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 { useNotificationService } from './hooks'; | |
function App() { | |
useNotificationService(); | |
... | |
} |
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
<application> | |
... | |
<!-- schedule local notification --> | |
<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/> | |
<receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver"> | |
<intent-filter> | |
<action android:name="android.intent.action.BOOT_COMPLETED"/> | |
<action android:name="android.intent.action.QUICKBOOT_POWERON"/> | |
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> | |
<category android:name="android.intent.category.DEFAULT" /> |