Tabnine Logo For Javascript
Module
Code IndexAdd Tabnine to your IDE (free)

How to use
Module
in
@react-native-firebase/messaging

Best JavaScript code snippets using @react-native-firebase/messaging.Module(Showing top 12 results out of 1,395)

origin: riantosm/firebase-push-notification

// when the app is running, but in the backgroud
  messaging().onNotificationOpenedApp(remoteMessage => {
   console.log(
    '[FCMService] onNotificationOpenedApp Notification caused app to open',
   );
   if (remoteMessage) {
    const notification = remoteMessage.notification;
    onOpenNotification(notification);
    // this.removeDeliveredNotification(notification.notificationId)
   }
  });
origin: riantosm/firebase-push-notification

messaging()
   .deleteToken()
   .catch(error => {
    console.log('[FCMService] delete token error ', error);
   });
origin: riantosm/firebase-push-notification

messaging()
   .requestPermission()
   .then(() => {
    this.getToken(onRegister);
   })
   .catch(error => {
    console.log('[FCMService] request permission rejected ', error);
   });
origin: riantosm/firebase-push-notification

messaging().onMessage(async remoteMessage => {
   console.log('[FCMService] a new FCM message arrived!', remoteMessage);
   if (remoteMessage) {
    let notification = null;
    if (Platform.OS === 'ios') {
     notification = remoteMessage.data.notification;
    } else {
     notification = remoteMessage.notification;
    }
    onNotification(notification);
   }
  })
origin: tuan072090/rn-example

const unsubscribe = messaging().onMessage(async remoteMessage => {
  console.warn("message when app opening...", remoteMessage)
});
messaging().onNotificationOpenedApp(remoteMessage => {
  console.warn(
    'app open from background state........:', remoteMessage,
  .getInitialNotification()
  .then(remoteMessage => {
    if (remoteMessage) {
origin: riantosm/firebase-push-notification

// when the app is opened from a quit state.
  messaging()
   .getInitialNotification()
   .then(remoteMessage => {
    console.log(
     '[FCMService] getInitialNotification Notification caused app to open',
    );
    if (remoteMessage) {
     const notification = remoteMessage.notification;
     onOpenNotification(notification);
     // this.removeDeliveredNotification(notification.notificationId)
    }
   });
origin: tuan072090/rn-example

return messaging().onTokenRefresh(token => {
  console.log('new token', token);
});
const authorizationStatus = await messaging().requestPermission();
console.log("authorizationStatus.....", authorizationStatus)
if (authorizationStatus) {
const deviceRemote = await messaging().registerDeviceForRemoteMessages();
const token = await messaging().getToken();
console.log("fcm token.......", token);
origin: riantosm/firebase-push-notification

// triggered when have new token
  messaging().onTokenRefresh(fcmToken => {
   console.log('[FCMService] new token refresg: ', fcmToken);
   onRegister(fcmToken);
  });
origin: riantosm/firebase-push-notification

messaging()
   .getToken()
   .then(fcmToken => {
    if (fcmToken) {
     onRegister(fcmToken);
     messaging().subscribeToTopic('all');
    } else {
     console.log('[FCMService] user does not have a device token');
    }
   })
   .catch(error => {
    console.log('[FCMService] getToken rejected ', error);
   });
origin: riantosm/firebase-push-notification

messaging()
   .hasPermission()
   .then(enabled => {
    if (enabled) {
     // user has permissions
     this.getToken(onRegister);
    } else {
     // user doens't have permission
     this.requestPermission(onRegister);
    }
   })
   .catch(error => {
    console.log('[FCMService] Permission rejected ', error);
   });
origin: tuan072090/rn-example

// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('handled in the background when app close and kill...', remoteMessage);
});
origin: riantosm/firebase-push-notification

messaging().setBackgroundMessageHandler(async remoteMessage => {
 console.log('Message handled in the background!', remoteMessage);
});
@react-native-firebase/messaging(npm)Module

Most used @react-native-firebase/messaging functions

  • Module.getInitialNotification
  • Module.getToken
  • Module.onMessage
  • Module.onNotificationOpenedApp
  • Module.onTokenRefresh
  • Module.setBackgroundMessageHandler,
  • Module.deleteToken,
  • Module.hasPermission,
  • Module.registerDeviceForRemoteMessages,
  • Module.subscribeToTopic,
  • RemoteMessage.data,
  • RemoteMessage.notification,
  • notification

Popular in JavaScript

  • chalk
    Terminal string styling done right
  • ms
    Tiny millisecond conversion utility
  • body-parser
    Node.js body parsing middleware
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • mongodb
    The official MongoDB driver for Node.js
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now