Push notification Token

Please provide the following:

  1. SDK Version: 38
  2. Platforms(Android/iOS/web/all): Android, IOS

Hi, im trying to get the expoPushToken with this code:

async function registerForPushNotificationsAsync() {
if (Constants.isDevice) {
const { status: existingStatus } = await Permissions.getAsync(
Permissions.NOTIFICATIONS
);
let finalStatus = existingStatus;
if (existingStatus !== “granted”) {
const { status } = await Permissions.askAsync(
Permissions.NOTIFICATIONS
);
finalStatus = status;
}
if (finalStatus !== “granted”) {
alert(“Failed to get push token for push notification!”);
return;
}
const token = await Notifications.getExpoPushTokenAsync();
console.log(token);
this.setState({ expoPushToken: token });
} else {
alert(“Must use physical device for Push Notifications”);
}
if (Platform.OS === “android”) {
Notifications.createChannelAndroidAsync(“default”, {
name: “default”,
sound: true,
priority: “max”,
vibrate: [0, 250, 250, 250],
});
}
}

and im getting this error/warn:
[Unhandled promise rejection: Error: Fetching the token failed: MISSING_INSTANCEID_SERVICE]

I have seen in videos that have the google.services in the app.json, but since I am using Expo, I did not generate an android app in Firebase, I generated a web App, therefore I do not have the IOS and Android modules in my project , so I can’t get the package Name and google.services.json … I attach images of the content of my app.json

![Captura de pantalla (35)|690x388, 75%]

hi! you’ll need to follow this guide when setting your Expo app up for android notifications. Besides that, you should refer to the FCM docs for this error message- InstanceID  |  Google Play services  |  Google Developers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.