invertase / invertase/react-native-firebase

🐛 [@react-native-firebase/installations] Auto-register APNs on iOS when using FID for messaging

Open
#9,112 3 comments 0 reactions 0 assignees View on GitHub
Needs Attention platform: ios plugin: installations plugin: messaging type: enhancement Workflow: Needs Review
Dominant language
TypeScript
Stars
12.3k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
79

Description

When targeting devices using **Firebase Installation IDs (FIDs)** obtained via `@react-native-firebase/installations` (as recommended in recent Firebase messaging documentation), sending push notifications to **iOS devices** fails from the backend with a `NotRegistered` (`UNREGISTERED` 404) error.

This happens because `@react-native-firebase/installations` operates independently from APNs. Unlike `messaging().getToken()`—which automatically handles or triggers APNs device registration under the hood—fetching an FID via `installations().getId()` does not register the device for remote notifications with Apple.

Because of this, Firebase's backend does not have an APNs token mapped to the FID on iOS, causing notifications to be rejected with `NotRegistered`.

---

When `FirebaseMessagingInstallationIdEnabled` is set to `true` (or when both `@react-native-firebase/messaging` and `@react-native-firebase/installations` are included in the project), the library should either:

1. Automatically trigger APNs registration (`registerDeviceForRemoteMessages()`) under the hood when fetching/syncing the FID on iOS.
2. Or provide an explicit helper method or configuration option within the SDK to automatically bind APNs registration to the FID, ensuring parity with how `messaging().getToken()` works.

----

Currently, the workaround on iOS is to manually force APNs registration before utilizing the FID:

```javascript
import messaging from '@react-native-firebase/messaging';
import installations from '@react-native-firebase/installations';

if (Platform.OS === 'ios') {
await messaging().registerDeviceForRemoteMessages();
}

const fid = await installations().getId();

```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how installations().getId() fetches or syncs the FID on iOS, then compare that path with messaging().registerDeviceForRemoteMessages(). Check the handling of FirebaseMessagingInstallationIdEnabled and determine how APNs registration should be triggered or exposed; done means an iOS FID has an APNs token mapped without the manual workaround and notifications no longer return NotRegistered.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.