Push Notification

iOS

Configuring Expo Push Notifications for iOS

iOS
Android

Configuration

Make sure you update the Configure config.ts :

config.ts
const config = {
   // other configurations
   // This is the bundle identifier of your ios App
   appIdPrefix: "com.expostarter.app",
}

Implement push notification handling

The project is pre-configured to present the user with a permission dialog when the user is first connected.

You can also trigger the permission dialog by calling setAppPreferences anywhere in your code :

home.tsx
export default function App() {
  const setAppPreferences = useSetAppPreferences();
 
  return(<Button onPress={() => {
      setAppPreferences({
        enableNotifications: true,
        hasPromptedForNotifications: true,
      });
    }}
  >
    <Text>
      Enable Notification
    </Text>
  </Button>)
}

Test your setup

Run your application on a device; simulators are not supported.

pnpm ios -d

Token will be stored and attached to the user in the backend

push token

Test your setup

Use Expo's push notification tool or REST API to send a test notification

android-notification

On this page