Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { Notifications, Permissions } from "expo";
const PUSH_ENDPOINT = "https://your-push-server/push-token"
async function registerForPushNotificationsAsync() {
// Request permissions -- same as earlier
// Get the token that uniquely identifies this device
const token = await Notifications.getExpoPushTokenAsync();
// POST the token to your backend server from where you can retrieve it to send push notifications.
return fetch(PUSH_ENDPOINT, {
method: "POST",
headers: {
Accept: "Content-Type": "application/json",
body: JSON.stringify({
token: {
value: token,
user: {
userId: "current_user_id",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.