Bare React Native (0.86) test app for the new ably/react-native-push plugin, installed from the local tarball ably-2.24.0.tgz.
The app can activate the device for push, show its deviceId, and subscribe/unsubscribe the device to an Ably channel. Push transport is FCM on Android and raw APNs on iOS (both transportType values of the plugin), with the token fetched via @react-native-firebase/messaging.
- Ably key — copy
.env.exampleto.envand setABLY_API_KEY(needs push capabilities). Restart Metro with--reset-cacheafter changing it (react-native-dotenv inlines it at transform time). - Android / FCM — drop your Firebase
google-services.jsonintoandroid/app/. (The google-services gradle plugin is applied only when the file exists, so the app builds without it — but FCM won't work until it's there.) - iOS / APNs — add
GoogleService-Info.plisttoios/RNPushExample/via Xcode (needed by react-native-firebase even though the raw APNs token is used), and set your signing team. Theaps-environmententitlement andremote-notificationbackground mode are already configured. Real pushes require a physical device. - Make sure the Ably app has FCM/APNs credentials configured in the dashboard (Notifications tab).
npm run android # emulator must have Play Services
npm run ios # physical device for actual pushesnpm caches tarballs per version. After rebuilding ably-2.24.0.tgz with the same version number:
npm install ./ably-2.24.0.tgz --force
npx react-native start --reset-cachepush.ts—ReactNativePush.create({ storage, requestToken })+Realtimeclient (module scope)App.tsx— activate/deactivate, deviceId display, channel subscribe/unsubscribe, foreground push alertsindex.js—setBackgroundMessageHandler(must be outside React)
ably push device list
ably push channel-subscriptions list --channel push:test
ably channels publish push:test --push '{"notification": {"title": "Hi", "body": "Test"}}'