Reading from Apple's documentation about Push Notifications:
application:didFinishLaunchingWithOptions:
method application:didReceiveRemoteNotification:
method So my question is which delegate gets called if the application is in background state (it is running or it's suspended)? Is it application:didFinishLaunchingWithOptions:
or application:didReceiveRemoteNotification:
?
Please help me, thank you!
application:didReceiveRemoteNotification: is called when your app is in the background.
A push service receives a network request, validates it and delivers a push message to the appropriate browser. If the browser is offline, the message is queued until the the browser comes online. Each browser can use any push service they want, it's something developers have no control over.
A background push notification is a silent, remote notification that helps keep your app's data up to date. Unlike regular push notifications, background push notifications do not show app icon badges, trigger a sound, or display a message when received by your app.
application:didReceiveRemoteNotification:
is called when your app is in the background. This question has an answer which tells you how to tell if your app was in the background or not.
application:didReceiveRemoteNotification:
is called when your app is in the background + the message alert still active.
Once the message alert is inactive then the application will not receive any event. Do correct me if I'm wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With