Please provide the following:
- SDK Version: 35
- Platforms(Android/iOS/web/all): Android
Hi, I’m developing an android app using expo sdk 35
and I’m having a problem regarding to our app’s push notification.
I just found out that Notifications.getExpoPushTokenAsync()
is not returning any token.
registerForPushNotificationsAsync = async () => {
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;
}
console.log(finalStatus);
var token = await Notifications.getExpoPushTokenAsync();
console.log(token);
this.setState({ expoPushToken: token });
} else {
alert('Must use physical device for Push Notifications');
}
};