iOS Question Which #Entitlement for Critical Alerts

schimanski

Well-Known Member
Licensed User
Longtime User
Is there someone who is using the function 'critical alerts'? I got the permission from apple and made the new privisioning profile. But which entitlement do i have to use?
I tried it with the following, but seems not to work. The sub Application_PuchToken will fail, if i use both enttitlements. Also should be in the settings the new switch to allow the critical alerts.

Thanks for help.

B4X:
#Entitlement: <key>aps-environment</key><string>production</string>
#Entitlement: <key>com.apple.developer.usernotifications.critical-alerts</key><boolean>1</boolean>

B4X:
Sub Application_PushToken (Success As Boolean, Token() As Byte)
        Log($"PushToken: ${Success}"$)
End Sub
 

schimanski

Well-Known Member
Licensed User
Longtime User
I changed it to:
B4X:
#Entitlement: <key>aps-environment</key><string>production</string>                  
#PlistExtra: <key>com.apple.developer.usernotifications.critical-alerts</key><true/>

but no effect, even the sub Application_PushToken is true.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Well, according to this page...
...it says ”Critical alerts require a special entitlement issued by Apple.”, which indicates that you should be issued a special entitlement from Apple. So perhaps look in your communication from them?
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Thank you!
There are no additional informations in the communication with apple, just a new tab under the identifiers in the apple console with a switch button. I followed the instructions from the link, but there are some settings in xcode about which i don't know.


I was hoping that maybe someone has had experience with it.
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
WHAT WE NEED TO ADD TO THE CODE
B4X:
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound, .criticalAlert]) { (granted, error) in}

I read all, which i found and i think we just need to request authorization. Is it not possible to implement it in b4i?
 
Upvote 0

Ralph Parkhurst

Member
Licensed User
Longtime User
B4X:
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound, .criticalAlert]) { (granted, error) in}

I read all, which i found and i think we just need to request authorization. Is it not possible to implement it in b4i?
Did you ever get an answer on this - I have exactly the same question
 
Upvote 0

Ralph Parkhurst

Member
Licensed User
Longtime User
No, unfortunately not. I never got it to work.
Okay, I understand. I am in a similar situation. This is what I have done so far:

1. Implement the entitlement within the B4i provisioning profiles (ad hoc and appstore). I think we have both done this already :)
2. Since I am using a B4J app to send FCM, add the 'critical' flag into the sound dictionary, thus:

B4X:
Message1.Put("apns", CreateMap("headers":CreateMap("apns-priority":"10", "apns-expiration":epochString), "payload":CreateMap("aps":CreateMap("sound":CreateMap("name":alarmSound, "critical": 1, "volume": 1)))))

3. Ensure that
B4X:
#Entitlement: <key>aps-environment</key><string>production</string>
is added near the top of the code.

It still doesn't work for me yet, but I will give it some more effort and see if I have any success. I will let you know.
 
Upvote 0
Top