I have an app on the app store currently and have rebuilt the entire app from scratch and for some reason after downloading from the app store the push notifications are not working. The app.json is exactly the same as the previous app the only difference is the sdk version. The new version uses SDK 49 as the other used SDK 47. I am not sure why the expo token is not being created when the user creates and account. The permission is requested from the user but the token is not generated. When testing the older version of the app the push notification works fine when downloading and testing in Testflight but the new verson will not send notifications.
I am using a development build for development and the notifications work just fine. It’s only once the app is on the app store and tested through testflight or downloaded offically from the app store that the issue persists. I am using EAS BUILD to generate provisional profiles etc… and it says that push notifications are set up during the process. Not sure what to do…. Testing with expo test notification generator works fine as well. All I have really done is rebuilt the app very similar to the previous version with minor differences.
async function registerForPushNotificationsAsync() {
let token;
if (Platform.OS === "android") {
await Notifications.setNotificationChannelAsync("default", {
name: "default",
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: "#FF231F7C",
});
}
if (Device.isDevice) {
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== "granted") {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== "granted") {
alert("Failed to get push token for push notification!");
return;
}
//getExpoPushTokenAsync is only for Expo Push Notifications
token = (
await Notifications.getDevicePushTokenAsync({
projectId: Constants.expoConfig.extra.eas.projectId,
})
).data;
console.log(token);
} else {
alert("Must use physical device for Push Notifications");
}
return token;
}




