Register device tokens and wake the app for incoming calls when backgrounded or killed.
Push Notifications
Foreground calling works with Hosted Signaling alone. To ring when the app is backgrounded or killed, you need push delivery + OS calling UI integrations.
Overview
- User grants notification / phone account permissions as required by the OS
- Your app obtains an FCM (Android) or APNs / PushKit VoIP (iOS) token
- App registers that token with Alaznah via
client.registerPushToken - When someone calls the user, Alaznah wakes the device
- Native incoming UI (full-screen intent / CallKit) can Accept or Decline
- JS resumes →
drainNativeIncomingAction+syncPendingCallsattach the call session
Developer Console
- Upload Android FCM credentials for your app
- Upload iOS APNs / VoIP push credentials
- Bind them to the same project you use for token minting
Exact file formats and fields are documented in the console for your plan.
Register the token
import messaging from '@react-native-firebase/messaging'; // example stack
import { Platform } from 'react-native';
const token = await messaging().getToken();
await client.registerPushToken(
token,
Platform.OS === 'ios' ? 'ios' : 'android',
);Re-register when the token rotates. Call after connect / when useCallingReady() is true.
On iOS VoIP, also wire PushKit → SDK helpers exported from @alaznah/calling (onIosVoipToken, registerIosVoipToken, incoming payload handlers) as shown in the examples/basic-call app.
App resume checklist
import { AppState } from 'react-native';
AppState.addEventListener('change', async (state) => {
if (state !== 'active') return;
await client.drainNativeIncomingAction();
await client.syncPendingCalls();
});This prevents a flash of the JS incoming screen after the user already acted on the native UI, and pulls any pending invites.
Testing tips
| Check | Why |
|---|---|
| Physical device | Push / CallKit / full-screen intent are unreliable or impossible on many simulators |
| Force-quit then call | Validates killed-state wake |
Dual userIds | Same user cannot meaningfully call themselves |
| Console credentials | Mismatch = silent push failure |
Related
- Incoming Calls
- Examples —
basic-callreference wiring - Troubleshooting