Push#
When a task changes on one of the user's devices, the others hear of it (#277): a notification that names the task, "Added: Buy milk" ("Neu: Buy milk"), and on the device that made the change none. The backend sends it straight to Apple's push service (APNs) and to Firebase Cloud Messaging (FCM), without Expo's push service or EAS (decisions/mobile-app.md), so the app registers its native token: APNs' in hex on iOS, FCM's on Android.
Only the qa and prod builds have push. The dev build talks to a backend on localhost, which sends
none, and has neither Firebase's configuration nor the push entitlement: nothing about push runs
there (push in mobile/src/variants.ts).
What this means for the user's data is in the privacy policy, Notifications of changed tasks (privacy.md), and the Datenschutzerklärung (datenschutz.md).
One offer for reminders and pushes#
iOS and Android have one notification permission per app, so the reminders' offer above the board is the offer of both (reminders.md): "Get notified about due and changed tasks?", with a line saying what comes, the pushes included.
- Whoever allowed the reminders gets pushes without being asked again.
- Whoever declined the reminders' offer, while it offered only them, is shown the new one once
more: it offers something new. A "Not now" to it is final again. The offer's file says which
answer it holds:
declinedwas the old "Not now",declined with pushis the new one (createReminderSchedulerinmobile/src/notifications.ts). - With push it is made though nothing is due: changes on other devices come regardless. In the dev build it waits for a task to be reminded of, as before.
Registering the phone#
PUT /api/devices/{installationId} with the platform (IOS or ANDROID), the token and the
app's language, as the app session (sign-in.md). The device lasts as long as that
session: signing out, the session's end after 30 days and deleting the account remove it at the
backend, so the app never unregisters. It registers:
- at every load of the board, the start's and the return to the foreground's;
- once the offer is taken and the phone allows it;
- when the token changes (expo-notifications'
addPushTokenListener).
Nothing is registered while notifications are not allowed. Each registration is sent once per app session and token: a load that finds both as they were sends nothing, a new sign-in sends again, as the backend ties the device to the session. The platform is asked for the token once per run, and the channel made once; after that the listener's tokens count, but not the one the platform hands it again whenever it is asked for one, which is being registered already. A registration that fails -- no connection, a backend from before #277 that answers 404, an Android build without Firebase, a simulator without APNs -- is logged and tried again at the next load. It never shows an error or holds up the board.
The installation id is a UUID in lower case with its hyphens, made once with expo-crypto's
randomUUID and kept in the keychain beside the app session. It is no secret; the keychain is
where the app keeps what must outlast a cleared cache, and on iOS it also outlasts a reinstall, as
the app session does, so a reinstalled app registers as the same phone rather than a second one.
A push arriving, and a push tapped#
- While the app is in the foreground a push shows no notification; the board loads anew
instead, and with it the reminders are scheduled anew. A reminder arriving then is shown as
before. The two are told apart by the notification's trigger: a push's is
type: 'push'(foregroundBehaviourandisPushinmobile/src/push.ts). - Tapped, a push opens the app on the board, which loads anew. There is no link to the task itself.
- A tap that brings the app back is told of twice, as a tap and as the return to the foreground, in either order: the board loads once for the pair, for whichever comes first within two seconds. A tap later than that, on Android's shade pulled over the open app, loads it again.
- Neither reloads over a form or the account sheet that is open, nor while a change is on its way, just as coming back to the foreground does not (account.md). The reload is owed then, and comes once the form or sheet is closed or the change answered.
Android: the channel#
Pushes have a channel of their own, Changed tasks ("Geänderte Aufgaben", id changes), beside
the reminders' Due tasks, so either can be switched off in the system settings. The backend's
FCM message names no channel; the build names changes Firebase's default channel (the
defaultChannel of expo-notifications' plugin in mobile/app.config.ts), and the app creates it
each time it registers -- before the backend knows the phone, so before any push can come. Should
the channel be missing all the same, Android shows the push on Firebase's fallback channel.
iOS: the entitlement#
expo-notifications' config plugin writes the push entitlement, aps-environment, into the app's
entitlements unless told not to. qa and prod get it as production, which TestFlight and the App
Store need; both App IDs have the Push Notifications capability (2026-11-30). The dev build gets
none, so its unsigned simulator build signs as before. The release's ad hoc signing keeps the
entitlement as generated (.github/scripts/sign-with-app-group.sh).
Firebase's file in the release#
An Android build reaches FCM through the Firebase app of its package, which google-services.json
names. Each environment has its own
(the decision), kept as a secret
of the app-stores environment: TASKFEST_QA_GOOGLE_SERVICES_JSON and
TASKFEST_PROD_GOOGLE_SERVICES_JSON (distribution.md). The release's Android
job writes the variant's to mobile/google-services.<variant>.json before it builds, and fails
there, naming the secret, when it is empty, or no google-services.json with a client for the
variant's package. The file is git-ignored, and mobile/app.config.ts
names it as android.googleServicesFile only where the variant has push and the file is there: CI's
builds and local ones build without it, and their registration fails quietly. iOS needs no such
file.
Firebase starts only when the app asks it to (Gunnar's decision): by default, Firebase Cloud
Messaging registers the installation with Google at every start, notifications allowed or not.
mobile/plugins/withoutFirebaseAutoStart.ts sets firebase_messaging_auto_init_enabled to false in
the manifest, and Analytics' collection beside it, as Firebase's guide says, so it registers when
the app asks for the token, once notifications are allowed (mobile/src/firebaseAutoStart.ts).
Firebase's docs do not say whether getToken, which expo-notifications calls, still hands out the
token with auto-start off. It does: v1.9.0's qa build got its token on an Android phone and
registered (2026-12-02, #277). Whether FCM delivers to such a token shows once Android is switched
on in qa. Should Android phones stop registering after an update of Firebase or expo-notifications
-- no ANDROID device in push's log, the app logging its failed registration -- auto-start comes
back on after the permission, with setAutoInitEnabled(true).
Trying it#
Tested in qa on 2026-12-02 (#277), with v1.9.0, whose Android builds were made by hand from the
tag (#707): first an iPhone and an iPad signed in as one user, then an iPhone and an Android phone,
once Google's side was made and the backend's FCM settings applied and redeployed
(names-and-certificates.md, steps
3 to 5). Changes reached the other device both ways, and the device that made the change got none.
Push logged a push was sent with platform ANDROID and failed: 0, so the exchange of AWS's
credentials for Google's token works. Without those settings push logs FCM is not configured:
Android phones get no push as it starts, and skips each Android phone.
A real push needs a qa or prod build on two devices signed in as one user: a change on one shows on the other. Without the backend:
-
The token: a development build (
__DEV__, asnpx expo run:iosorrun:androidmakes one) logs its native push token once, as it first gets it -- once notifications are allowed and it registers:Push token (development build only): <token>. It shows in the terminal Metro runs in, and in the device's log: Xcode's console or Console.app for iOS,adb logcatfor Android. A release build never logs it (logTokeninmobile/src/push.ts). -
iOS simulator, with a qa build run locally (
APP_VARIANT=qa npx expo run:ios):xcrun simctl push booted de.hilling.taskfest.qa push.apnsdelivers a file such as{"aps": {"alert": {"title": "TaskFest QA", "body": "Added: Buy milk"}, "sound": "default"}, "taskId": "7"}. In the foreground the board reloads and nothing shows; in the background it shows, and a tap opens the board. The simulator's token, if it gets one, is no use to the backend. - Android emulator, with a Google Play image, a qa build run locally (
APP_VARIANT=qa npx expo run:android) andmobile/google-services.qa.jsonin place: a test message from the Firebase console's Messaging, sent to the token the build logged.
Code and tests#
| Piece | Where |
|---|---|
| Registering, the installation id, a push told from a reminder | mobile/src/push.ts |
| The request | registerDevice in mobile/src/api.ts |
| expo-notifications adapted, the foreground handler | mobile/src/Main.tsx |
| When it registers, reloading on a push, the offer | mobile/src/TaskFestApp.tsx |
| The offer made once more | createReminderScheduler in mobile/src/notifications.ts |
| Which builds have push; the entitlement, Firebase's file and channel | mobile/src/variants.ts, mobile/app.config.ts |
| The release's Firebase file | .github/workflows/mobile-release.yml |
| Firebase started only by the app | mobile/src/firebaseAutoStart.ts, mobile/plugins/withoutFirebaseAutoStart.ts |
push.test.ts, api.devices.test.ts, TaskFestApp.push.test.tsx, variants.push.test.ts,
appConfig.test.ts, appConfig.firebase.test.ts and firebaseAutoStart.test.ts cover them;
notifications.test.ts the offer made once more.