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

Obtain the platform device token with whatever push integration your app already uses, then register it with Alaznah:

ts
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

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