'How to make critical alerts in ios with expo sdk 42 managed

i have created an app for our local Fire Station with Push Notifications in emergency cases. This works as expected. Now the critical alerts entitlement request is approved by apple and i want to integrate this feature.

The problem is, i cant find a way to request the critical alert permission in app. I tried the following to get the permission...

const test = await Notifications.requestPermissionsAsync({
      android: {},
      ios: {
        allowAlert: true,
        allowBadge: true,
        allowSound: true,
        allowAnnouncements: true,
        allowCriticalAlerts: true
      }
})
console.log(test)

but in the request response i can see that "allowsCriticalAlerts": null, here is the response:

"ios": Object {
  "alertStyle": 2,
  "allowsAlert": true,
  "allowsAnnouncements": null,
  "allowsBadge": true,
  "allowsCriticalAlerts": null,
  "allowsDisplayInCarPlay": null,
  "allowsDisplayInNotificationCenter": true,
  "allowsDisplayOnLockScreen": true,
  "allowsPreviews": 1,
  "allowsSound": true,
  "providesAppNotificationSettings": false,
  "status": 2,
},
"status": "granted",
}

Anyone have an idea to get it working within an managed expo (sdk 42) app?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source