0

I'm using OneSignal Swift in a native iOS application. So far i'm able to handle all kinds of push notification cases (foreground/background) except one. When user has force closed the application from "task bar switcher".

I'm using 'content-available':'true' in all my notifications through OneSignal in order to wake up my app and start running code the exact moment the notification is received. So far so good everything is working as expected. When the app is closed and push notification arrives, if user taps it, then handling with OneSignal works with OSHandleNotificationActionBlock callback.

The problem though is if user doesn't tap and just opens through application icon, then notification data are completely lost. Online reference dictates that the correct way of handling this (what most apps like Facebook do), is query tour APNS (OneSignal in my case) for unhandled notifications and re-fetch them on application start. So the question is how to do that from OneSignal iOS native SDK? Is it possible? There is ofc the REST Service -which might be the case- but users are clearly discouraged to call the API from inside client application. An app key is necessary which shouldn't be saved in device's keychain apparently for security reasons(??)...

Jimi
  • 198
  • 2
  • 13
  • Notifications are never guaranteed to be delivered to your app. Your app should query the underlying database when it starts rather than attempting to determine whether notifications have been "missed". – Paulw11 Mar 24 '17 at 20:40
  • The question is how can I do that by taking advantage of OneSignal's features. – Jimi Mar 25 '17 at 17:30
  • You don't. Onesignal is a push notification service, not a back end database. – Paulw11 Mar 25 '17 at 19:50
  • So I have to implement all that by myself? OneSignal is just for pushing and handling segments and styles? Doesn't keep track of delivered/failed/clicked notifications for each player? – Jimi Mar 26 '17 at 08:41
  • 1
    Thats correct. OneSignal just passes the message off to Apple's service for delivery. At that point delivery is not guaranteed and there is no feedback if a notification is not delivered. For example, a device might be in airplane mode and a notification is sent. This will be pending until the phone reconnects to a network. If a second notification is sent for the same app then the first notification is discarded and the second one is now pending. There is no notification to sender or receiver that the first notification was discarded. – Paulw11 Mar 26 '17 at 08:46
  • Ok that does make sense. Is there any reference/knowledge base you can point me to, in order to start implementing? Sounds like a lot of work, isn't it? – Jimi Mar 26 '17 at 10:03
  • There are a few backend-as-a-service (BaaS) providers you can use; Firebase, backendless, yo can host a parse instance on your own server and so on. – Paulw11 Mar 26 '17 at 10:05
  • I'll look into that. Thank you for the support! – Jimi Mar 26 '17 at 10:15

0 Answers0