@@ -284,16 +284,8 @@ NOTE: `com.evollu.react.fcm.FIRLocalMessagingPublisher` is required for presenti
...
@@ -284,16 +284,8 @@ NOTE: `com.evollu.react.fcm.FIRLocalMessagingPublisher` is required for presenti
import {Platform} from 'react-native';
import {Platform} from 'react-native';
import FCM, {FCMEvent, RemoteNotificationResult, WillPresentNotificationResult, NotificationType} from 'react-native-fcm';
import FCM, {FCMEvent, RemoteNotificationResult, WillPresentNotificationResult, NotificationType} from 'react-native-fcm';
class App extends Component {
// this shall be called regardless of app state: running, background or not running. Won't be called when app is killed by user in iOS
componentDidMount() {
FCM.on(FCMEvent.Notification, async (notif) => {
FCM.requestPermissions(); // for iOS
FCM.getFCMToken().then(token => {
console.log(token)
// store fcm token in your server
});
// NOTE: if you want to handle notifications when app is closed, put another handler outside of component lifecycle because components won't be initialized.