Removes access to an FCM token previously authorized by it's scope. Messages sent by the server to this token will fail.
Optionaloptions: NativeTokenOptionsOptions to override senderId (iOS) and appName (android)
Firebase JS 12.14+, Android Messaging 25.1+, and Apple 12.18+ deprecated FCM token
APIs (getToken, deleteToken, onTokenRefresh) in favor of FID registration (unregister /
onUnregistered). Prefer Messaging.unregister and Messaging.onUnregistered
after opting in to Installation ID messaging. Token APIs still work while the FID flag is off.
On iOS, it is possible to get the users APNs token. This may be required if you want to send messages to your iOS devices without using the FCM service.
You can safely call this method on Android without platform checks. It's a no-op on Android and will promise resolve
null.
When the app is opened from iOS notifications settings from a quit state,
this method will return true or false if the app was opened via another method.
When a notification from FCM has triggered the application to open from a quit state,
this method will return a RemoteMessage containing the notification data, or null if
the app was opened via another method.
iOS only - Returns whether the root view is headless or not i.e true if the app was launched in the background (for example, by data-only cloud message)
Returns an FCM token for this device. Optionally you can specify a custom options to your own use-case.
Optionaloptions: GetTokenOptions & NativeTokenOptionsOptions composite type with all members of GetTokenOptions and NativeTokenOptions
Firebase JS 12.14+, Android Messaging 25.1+, and Apple 12.18+ deprecated FCM token
APIs (getToken, deleteToken, onTokenRefresh) in favor of FID registration (register /
onRegistered). Prefer Messaging.register and Messaging.onRegistered after
opting in to Installation ID messaging. Token APIs still work while the FID flag is off.
Returns a AuthorizationStatus as to whether the user has messaging permission for this app.
Use react-native-permissions or expo-notifications for notification permission requests instead. These APIs will be removed in a future major release. See #6283.
On Web, checks if all required APIs exist in the browser.
On Android, called when the FCM server deletes pending messages.
Returns an unsubscribe function to stop listening for deleted messages.
Called when the FCM deletes pending messages.
When any FCM payload is received, the listener callback is called with a RemoteMessage.
Returns an unsubscribe function to stop listening for new messages.
This subscriber method is only called when the app is active (in the foreground).
Called with a RemoteMessage when a new FCM payload is received from the server.
On Android, when sending a RemoteMessage, this listener is called when the message has been sent to FCM.
Returns an unsubscribe function to stop listening for sent messages.
Called when the FCM sends the remote message to FCM.
When the user presses a notification displayed via FCM, this listener will be called if the app has opened from a background state.
Called with a RemoteMessage when a notification press opens the application.
Subscribes to Firebase Installation ID (FID) registration events.
Fires for explicit register(), auto-init at startup, and installation-id rotation.
While still registered, a new subscriber receives the cached FID immediately; later events
still fire.
Requires Installation ID messaging to be enabled. See Messaging.register.
When sending a RemoteMessage, this listener is called when an error is thrown and the
message could not be sent.
Returns an unsubscribe function to stop listening for sent errors.
NOTE: Android only
Called when a new registration token is generated for the device. For example, this event can happen when a token expires or when the server invalidates the token.
Returns an unsubscribe function to stop listening for token refresh events.
This subscriber method is only called when the app is active (in the foreground).
Called with a FCM token when the token is refreshed.
Firebase JS 12.14+, Android Messaging 25.1+, and Apple 12.18+ deprecated FCM token
APIs (getToken, deleteToken, onTokenRefresh) in favor of FID registration (register /
onRegistered). Prefer Messaging.register and Messaging.onRegistered after
opting in to Installation ID messaging. Token APIs still work while the FID flag is off.
Subscribes to Firebase Installation ID (FID) unregistration events.
Fires only after a successful unregister(), with that FID. Does not replay to a late
subscriber.
Requires Installation ID messaging to be enabled. See Messaging.register.
Registers the app instance with FCM using its Firebase Installation ID (FID).
Requires Installation ID messaging to be enabled (Android meta-data
firebase_messaging_installation_id_enabled, iOS Info.plist
FirebaseMessagingInstallationIdEnabled, or Expo plugin installationIdEnabled: true).
Does not call registerDeviceForRemoteMessages / APNs registration.
Web-only RegisterOptions fields are ignored on React Native.
Optionaloptions: RegisterOptionsOptional web-parity options (ignored on native).
On iOS, if your app wants to receive remote messages from FCM (via APNs), you must explicitly register with APNs if auto-registration has been disabled.
On ARM64 iOS Simulator, UIKit registration is skipped intentionally so the main thread
cannot wedge; the call may reject with messaging/registration-timeout after ~10s and will
not produce a real APNs token. Use a physical device for end-to-end push. Overlapping calls
reject the earlier attempt with messaging/registration-superseded.
requestPermission's APNs side-effect is also skipped on ARM64 Simulator but that Promise
still resolves with AuthorizationStatus (it does not reject with these codes).
You can safely call this method on Android without platform checks. It's a no-op on Android and will promise resolve
void.
On iOS, messaging permission must be requested by the current application before messages can be received or sent.
You can safely call this method on Android without platform checks. It's a no-op on Android and will promise resolve
AuthorizationStatus.AUTHORIZED.
Optionalpermissions: IOSPermissionsUse react-native-permissions or expo-notifications for notification permission requests instead. These APIs will be removed in a future major release. See #6283.
On Android, send a new RemoteMessage to the FCM server.
A RemoteMessage interface.
On iOS, This method is used to set the APNs Token received by the application delegate.
You can safely call this method on Android without platform checks. It's a no-op on Android and will promise resolve
null.
a hexadecimal string representing your APNS token
Optionaltype: stringoptional string specifying 'prod', 'sandbox' or 'unknown' token type
Sets whether auto initialization for messaging is enabled or disabled.
A boolean value to enable or disable auto initialization.
Set a message handler function which is called when the app is in the background or terminated.
called with an argument of type messaging.RemoteMessage that must be async and return a Promise
Sets whether message delivery metrics are exported to BigQuery is enabled or disabled.
A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
Sets whether remote notification delegation to Google Play Services is enabled or disabled.
A boolean value to enable or disable remote notification delegation to Google Play Services.
On iOS, set a handler function which is called when the ${App Name} notifications settings
link in iOS settings is clicked.
Apps can subscribe to a topic, which allows the FCM server to send targeted messages to only those devices subscribed to that topic.
The topic name.
Unregisters the app instance from FCM so the current Firebase Installation ID is no longer active for receiving messages.
Requires Installation ID messaging to be enabled. See Messaging.register.
On iOS, unregisters the app from receiving remote notifications.
You can safely call this method on Android without platform checks. It's a no-op on Android and will promise resolve
void.
Unsubscribe the device from a topic.
The topic name.
The FirebaseApp this module is associated with
Returns whether messaging auto initialization is enabled or disabled for the device.
Returns whether message delivery metrics are exported to BigQuery.
On iOS, returns a boolean value whether the user has registered for remote notifications via
registerDeviceForRemoteMessages().
You can safely access this property on Android without platform checks. Android returns
trueonly.
Returns whether remote notification delegation to Google Play Services is enabled or disabled.
You can safely access this property on iOS without platform checks. iOS returns
falseonly.
The Firebase Messaging service interface.