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
Obtain the platform device token with whatever push integration your app already uses, then register it with Alaznah:
import { Platform } from 'react-native';
const token = await getYourDevicePushToken(); // your app's push layer
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 paths, also wire the OS VoIP token into the helpers exported from @alaznah/calling (onIosVoipToken, registerIosVoipToken, and incoming payload handlers). See the public examples repo 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