Reputation: 1987
There is several situations when receiving a remote notification:
what I am looking for is that user haven't click the notification to launch or active the app. can we catch the receiving and do some thing in such three situation?
I know 2 is ok, how about 1 and 3, and how to do it? thx a lot.
somebody mentions widget or NotificationService? is it possible?
Upvotes: 1
Views: 190
Reputation: 10092
You can try adding a Notification Service Extension to your app.
iOS will launch your extension (NOT your app) in background when it receives a push notification. Obviously what you can do inside an extension is fairly limited.
Upvotes: 2
Reputation: 5643
There are two ways to be notified when your app moves to the background: implement the applicationWillResignActive()
method in your app delegate, or register for the UIApplication.willResignActiveNotification
notification anywhere in your app. This particular notification is sent as soon as your app loses focus, meaning that it's triggered when the user taps the home button once (to return to the home screen) or double taps the home button (to enter multi-tasking).
Upvotes: 1