Mobile
Expo push notifications
What the Expo starter configures for notifications, and the permission call it makes on launch.
The Mobile App Starter (Expo) depends on expo-notifications ~0.29.0 and sets a foreground handler. It asks for permission. It does not register a push token or send a notification. This page describes the code that is there, and the call you add when you want a token.
Handler
At module scope in App.tsx:
import * as Notifications from "expo-notifications";
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false
})
});
shouldShowAlert: true tells Expo to present a notification that arrives while the app is foregrounded. Sound and badge are off. This does not schedule a notification and it does not request permission by itself.
Permission on launch
useEffect(() => {
readToken().then((token) => {
setAuthed(Boolean(token));
setReady(true);
});
Notifications.requestPermissionsAsync().catch(() => undefined);
}, []);
requestPermissionsAsync() runs every cold start, in parallel with the SecureStore read. The result is ignored. A rejection is swallowed. The session logic is separate and is documented in Expo authentication architecture.
On iOS, a push token also requires the push notification entitlement and a physical device. The starter does not add that entitlement in the files it ships. Calling getExpoPushTokenAsync without it fails at runtime.
Getting a token is a separate step
The kit never calls getExpoPushTokenAsync. When you add it, do it after permission is granted, and send the data string to your API with the bearer token from SecureStore. Store that string on the user on the server. The Expo push service accepts it later when you POST to Expo’s push endpoint from your backend, not from the app.
Do not put that POST in the client. The client only needs to obtain the token and upload it. The starter stops before that upload, which is why the home screen can still render when the API is down: notifications are not required for navigation.
Want to skip the setup? The Mobile App Starter (Expo) already includes the notification handler and the permission request, next to onboarding, auth, and tabs.