Issue on iOS Standalone TestFlight: Permissions.getAsync(Permissions.NOTIFICATIONS) returns status as granted always.

Hi there,

Posting issue/question for first time…

the following code returns “granted” on iPhone…
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);

The followup call to let token = await Notifications.getExpoPushTokenAsync();
throws exception “Error: This app does not have permission to show notifications”

All the notifications related functionality is blocked due to this.

Am I missing anything, This was working till < 27.0.0. Now i am on ver 30.0.0 Please help.
Thanks in advance,

  • DP

Hey @techpanga,

Is this occurring on a standalone app or on the Expo Client?

Cheers,

Adam

@adamjnav

his is occurring on Standalone app.

-thanks
Dp.

Hi there

Any help is greatly appreciated. Please let me know in case of more details

-regards Dp

excuse my English. The iOS emulator does not allow permission for notifications, you must try on a real iPhone. Your problem should be because although the user says no to the notification permission you are asking for the token

requestPushNotificationsPermission = async () => {
if (Expo.Constants.isDevice === true) {
if (Platform.OS === ‘android’) {
this.hacerLogin(await Notifications.getExpoPushTokenAsync());
} else {
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') {
      this.hacerLogin(Expo.Constants.installationId);
    } else {
      this.hacerLogin(await Notifications.getExpoPushTokenAsync());
    }
  }
} else {
  this.hacerLogin(Expo.Constants.installationId);
}

}

The issue is on standalone app deployed to iPhone via TestFlight.

-thanks. Dp

I also happened to the same thing and solved it as mentioned above

Joyner,
Thank you for response. Somehow this did not work for me.

Is there a way to reset the permissions for an app. I am not sure why iphone remembering the permissions even after remove and add the app from TestFlight. I see few other threads asked for same issue and were closed automatically after 15 days of inactivity.

-thanks, dp

Hi

To keep this simple, On iOS Standalone iPhone XS Max device,

After the below statement…
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);

the variable “existingStatus” always gets the value as “granted”

After below statement…
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);

the variable “status” always gets the value as “granted”

I am not sure how to RESET these permissions.

Also, this issue is mentioned here Expo 29.0 on iOS is no longer resolving Permissions.askAsync promise for NOTIFICATIONS . And Is the fix included in version 31.0.0.

Any help is greatly appreciated.

-thank you, dp.

Looks like someone posted same issue here https://github.com/expo/expo/issues/2648

And sounds related to

and

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