nburk
nburk

Reputation: 22731

Execute background task after local notification was received in didReceiveLocalNotification:

Is it possible to execute a background task with [application beginBackgroundTaskWithName:@"LOG_STUFF" expirationHandler:^{}]; in the AppDelegate's method application:didReceiveLocalNotification:

Upvotes: 1

Views: 681

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

If your application is in the foreground, yes!

If your app is suspended (already in the background), the app has to be brought to the foreground for the "didReceiveLocalNotification:" method to fire and for you to be able to begin your background task.

Check out Apple's documentation for "beginBackgroundTaskWithExpirationHandler:" method for more details on how to properly use this API.

Upvotes: 3

Related Questions