简体   繁体   English

如何在 ios 和 expo sdk 42 管理中发出严重警报

[英]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:但在请求响应中我可以看到“allowsCriticalAlerts”:null,这是响应:

"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?任何人都有想法让它在托管 expo (sdk 42) 应用程序中工作?

All configuration steps are completely ok.所有配置步骤完全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:我在 app.json 中的配置如下所示:

"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.如果 apple 批准了您的关键警报请求并且您的配置正常,那么一切都必须按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM