Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

expo

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?

like image 987
Daniel Richter Avatar asked Sep 18 '25 16:09

Daniel Richter


1 Answers

All configuration steps are completely ok. Nothing wrong. One day we get a new App user and he was asked after installation to receive critical alerts. So now i deleted my app complete from my phone and reinstalled it.

Thats it. Now i was getting the critical alerts request too and all works fine.

My configuration in app.json looks like this:

"ios": {
  "infoPlist": {
    "com.apple.developer.usernotifications.critical-alerts": 1
  },
  "entitlements": {
    "com.apple.developer.usernotifications.critical-alerts": true
  }

if apple granted your critical alerts request and your config is ok all have to work as expected.

like image 113
Daniel Richter Avatar answered Sep 21 '25 06:09

Daniel Richter