After IOS13 update silent notification doesn't wake app

gaborxgaborx USMember ✭✭
edited December 3 in Xamarin.iOS

Our app has to receive silent notification from a service to work properly. Like check-in now with location info...etc. It worked perfectly before IOS13.
However it stopped working since the update. The phone receive the silent notification but IOS never wakes the app to process it if the app is in background.
I use the new headers :
request.Headers.Add("apns-id", Guid.NewGuid().ToString("D"));
request.Headers.Add("apns-push-type", "background");
request.Headers.Add("apns-priority", "5"));
request.Headers.Add("apns-topic", {BundleId});

My payload worked before however i tried the one from Apple docs as well still no luck :
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}

I found on Apple forum few workarounds like send empty alert object..etc. I tried all of them still no luck.
And thisall worked perfectly before IOS13!
Is anyone have any idea what is going on with the silent push notifications now on IOS13 and how to actually send one ?!

Weird enough, when I simply plug the phone through USB into the MAC, the silent notifications work as before.

Best Answer

  • gaborxgaborx US ✭✭
    Accepted Answer

    Found a workaround! I send a normal alerted message with the proper alert header, but add the content-available:1, then IOS13 does not show the notification, only lights the phone up for a sec, and wakes my application to process the message! I have to send NOT the silent message format (with the "background" header)!!!, but the proper alerted message, like a normal push notification, but with content-available included!

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Check https://forums.developer.apple.com/thread/121568 .

    As hsialern suggested ,try to add an empty alert field in the aps header

    "aps": {
    
      "alert":{},
    
      "content-available": 1
    
      }
    
  • gaborxgaborx USMember ✭✭

    I tried that as well earlier as I wrote in my post and didn't work.

  • ColeXColeX Member, Xamarin Team Xamurai
    edited December 4

    @gaborx said:
    I tried that as well earlier as I wrote in my post and didn't work.

    well ,try to put some value in alert to see if it works . It is mentioned in the last comment in that link .

  • gaborxgaborx USMember ✭✭
    Accepted Answer

    Found a workaround! I send a normal alerted message with the proper alert header, but add the content-available:1, then IOS13 does not show the notification, only lights the phone up for a sec, and wakes my application to process the message! I have to send NOT the silent message format (with the "background" header)!!!, but the proper alerted message, like a normal push notification, but with content-available included!

Sign In or Register to comment.