onmyway133 / PushNotifications

🐉 A macOS, Linux, Windows app to test push notifications on iOS and Android
https://onmyway133.com
Other
2.26k stars 176 forks source link

Voip Notification issue #27

Closed Muhammedayaz77 closed 4 years ago

Muhammedayaz77 commented 4 years ago

hi i am facing issue in voip notification "Failed: InvalidPushType". I am working on iOS13 and Xcode 11. Can you please add push type in UI. Actually PushType we need to add in header not in payload.

Ariandr commented 4 years ago

Hi @Muhammedayaz77 We set apns-push-type header automatically, depending on the payload. It is set to alert in all cases except when aps consist of just this (silent notification, aka background):

"aps" : {
        "content-available" : 1
 }

Otherwise, it wouldn't work.

Ariandr commented 4 years ago

@Muhammedayaz77 Can you provide the payload you are sending?

Muhammedayaz77 commented 4 years ago

hay i am trying to send the Voip notification and for me still it showing "Failed: InvalidPushType" Can you please fix this ASAP. if i create a build from Xcode 10 this app works fine. but new i updated my Xcode as Xcode 11 then i start facing this issue. i am not able to send a single voip notification

payload for Voip :
{ "aps" : { "alert" : "You got call.", "badge" : 9 } }

payload for silent notification : { "aps" : { "content-available" : 1 } }

if you need any other details please fill free to mail on my mail id "ayaz.job2010@gmail.com"

Ariandr commented 4 years ago

Hi @Muhammedayaz77 The issue you might not realize is the changes which Apple introduced with iOS 13 SDK. Now you cannot use VoIP notifications for old use cases That's why when you build with Xcode 11, you switch to the new SDK, your app might not receive such notifications.

There is a great article from OneSignal and there is a section dedicated specifically to VoIP issue, please have a look: iOS 13 and Xcode 11 Changes That Affect Push Notifications

VoIP Changes Apple supports a special type of VoIP (Voice over IP) push permission for some applications. This API was designed for apps that receive voice or video calls, such as Facebook Messenger or Skype.

Developers found that this special push type also had a few other valuable use-cases, including:

  1. Applications that were swiped-away from the task switcher could still receive background data notifications. Normally background notifications are ignored if a user closed an app in this method.
  2. Applications were using this API in order to support receiving encrypted background messages. They would then decrypt the message client side, and then show a local notification.
  3. Some apps were using this to periodically trigger their app to run code in the background, such as to reliably synchronize data so the user could view it while offline. Apple recently changed this permission to require displaying a notification or incoming VoIP call to the user. As a result, VoIP notifications can no longer be used for the three above use-cases, or any other use case that's not related to receiving a VoIP call.

Instead, Apple recommends implementing many of the above use-cases by using either content-available background notifications, or for the decryption use-case, Apple recommends using a Notification Service Extension. Apple is also introducing a new background tasks framework for cases where apps may need to schedule tasks to happen in the future. These changes, and recommendations on how to handle them, are outlined in Apple's recent WWDC presentation on privacy changes in iOS 13