1

Is it possible to call a certain method from the AppDelegate after a push notification has been received while the app is in inactive state (Terminated)?

I know it is possible to call a method when the app is opened from the notification (eg. tapping a banner in notification center.)

I'd like to perform a small geolocation check when a push is received from my server. Is that possible and wont my app get rejected?

Martin Herman
  • 888
  • 13
  • 34

4 Answers4

1

You can handle a push notification in

- (void)application:(UIApplication *)application 
didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler

when app is in background state and working, not inactive. But you can send a sound & text notification when app is inactive but you can't do anything.

Inactive I mean suspended - not working at all (neither foreground nor background).

Idan Moshe
  • 1,675
  • 4
  • 28
  • 65
0

It is not possible. Your app badge will only be updated if you are sending it from the server.

Gaurav
  • 299
  • 4
  • 15
0

There is no API that allows doing something after push on inactive app without user interactions

Nikita Took
  • 3,980
  • 25
  • 33
0

Apple says: "Inactive State:: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state."

So It's not possible that you want.

Tapas Pal
  • 7,073
  • 8
  • 39
  • 86