I’m new to coding, and I am trying to implement Expo Push Notifications. Right now it seems to be generating the expo push token when I run my Android simulator, but it does not generate it when I run my iOS simulator.
async registerForPushNotificationsAsync() {
console.log("running push notif function");
const { status: existingStatus } = await Permissions.getAsync(
Permissions.NOTIFICATIONS
);
let finalStatus = existingStatus;
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== 'granted') {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}
// Stop here if the user did not grant permissions
if (finalStatus !== 'granted') {
return;
}
// Get the token that uniquely identifies this device
let token = await Notifications.getExpoPushTokenAsync();
console.log(token); //not logging for iOS
}
I’m using sdkVersion 26.0.0