Push Notifications
AlogamePush wraps the native SDK's push notification setup (Firebase Cloud
Messaging on Android, APNs on iOS). Native project setup (Firebase config,
manifest entries, entitlements) still follows the platform SDK guides — see
Android → Push Notifications and the iOS equivalent; this
page only covers the JS-side calls.
Unlike the built-in login/payment UI and logEvent/logRevenue, push has
zero call sites in either of the two reference apps this bridge was
validated against. It's wired and functional, but treat it as less
battle-tested than the payment/analytics paths above.
Request permission
import { AlogamePush } from 'alogame-sdk';
const granted = await AlogamePush.requestPermission();
- Android < 13: always resolves
true(no runtime permission exists). - Android 13+: shows the system prompt.
- iOS: shows the system notification permission prompt.
Read the device token
const token = await AlogamePush.getDeviceToken();
nullThe native iOS SDK has no public getter for the current push token — it's
registration-driven (delivered via didRegisterForRemoteNotifications), not
pull-based like Android. This is a native SDK gap, not a bridge bug — fully
functional on Android.
Topic subscriptions (Android-only)
await AlogamePush.subscribeToTopic('events');
await AlogamePush.unsubscribeFromTopic('events');
FCM topics have no APNs equivalent — these reject on iOS. Guard the call if your game runs on both platforms:
try {
await AlogamePush.subscribeToTopic('events');
} catch {
// Expected on iOS — no-op
}