HomeGuidesReferenceLearn
ArchiveExpo SnackDiscord and ForumsNewsletter

Obtaining a device token for sending to FCM or APNs

Edit this page

Learn how to obtain native device tokens.


Before communicating directly with FCM and APNs, there is one client-side change you'll need to make in your app. When using Expo's notification service, you collect the ExponentPushToken with getExpoPushTokenAsync. Now that you're not using Expo's notification service, you'll need to collect the native device token instead with getDevicePushTokenAsync.

import * as Notifications from 'expo-notifications';
...
- const token = (await Notifications.getExpoPushTokenAsync()).data;
+ const token = (await Notifications.getDevicePushTokenAsync()).data;
// send token to your server

After getting the native device token, you can start implementing the servers.