Codota Logo For Javascript
Module
Code IndexAdd Codota 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

  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • fs
  • commander
    the complete solution for node.js command-line programs
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • glob
    a little globber
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • axios
    Promise based HTTP client for the browser and node.js
  • path
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now