Alaznah

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

  1. User grants notification / phone account permissions as required by the OS
  2. Your app obtains an FCM (Android) or APNs / PushKit VoIP (iOS) token
  3. App registers that token with Alaznah via client.registerPushToken
  4. When someone calls the user, Alaznah wakes the device
  5. Native incoming UI (full-screen intent / CallKit) can Accept or Decline
  6. JS resumes → drainNativeIncomingAction + syncPendingCalls attach the call session

Developer Console

In console.alaznah.com:

  • 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

ts
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

ts
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

CheckWhy
Physical devicePush / CallKit / full-screen intent are unreliable or impossible on many simulators
Force-quit then callValidates killed-state wake
Dual userIdsSame user cannot meaningfully call themselves
Console credentialsMismatch = silent push failure