Hitesh
Hitesh

Reputation: 399

iOS7 UIBackgroundModes Fetch with launch app from background mode

I am trying to download some files in the background with new iOS 7 feature UIBackgroundModes Fetch and file is downloading successfully in background

But I wantwhen my download completes in the background ,App should come in the Foreground I have also called the method setMinimumBackgroundFetchInterval in didFinishLaunchingWithOptions. But application:performFetchWithCompletionHandler method is not getting called in from background as well as foreground after download completes.

Is it possible to launch app in foreground after download completes?

Upvotes: 1

Views: 2515

Answers (2)

iCreative
iCreative

Reputation: 1506

You can fire Local Notification for this purpose. Schedule local notification once your download completes. Once download finishes, App will fire notification, User selects the notification & after clicking it, the application will open up.

Here are some good tutorials for adding local notification:

Local notification Sample 1

Local notification sample 2

Upvotes: 4

hukir
hukir

Reputation: 1743

Short answer, nope.

The only thing an app is supposed to do when called for a background fetch is perform any data fetching that the app needs. Then the completion handler is supposed to specify whether there was an error, new data, or no change. If there was new data, the app screenshot in the app switcher is updated. That's the extent of background fetching, hence the name.

There is no way to bring your app to the foreground. The only way to have an app come to the foreground in iOS is through a user action.

Upvotes: 2

Related Questions