0

Is it possible to open the background app into foreground in iOS ?.

I have a scenario like, If suppose my application in background then after sometime I need to up the application into foreground programmatically. Is it possible ?

I don't need to upload the application in Appstore.

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130

3 Answers3

1

Yes, it is possible.

You can wake your app up by different kinds of criteria using Push Notifications or Local Notifications. Remotely by using Push Notifications. Locally by calendar alerts, location-based triggers or task alerts.

The users can configure and complete turn of Notifications for your app, in which case it is not possible.

See introduction from Apple here. https://developer.apple.com/notifications/

PO Bengtsson
  • 299
  • 3
  • 6
1

As far as i know iOS does not provide a way to open your app. You can continue long running tasks while in the background opportunistically fetch content remind users to re-open your app if need be and prompt the first two with silent push notifications if need be.

  • The background fetch task can we run for a long time (5 hour) . Not downloading a content. Can we check Wifi status for a long time ? – Vineesh TP Feb 03 '17 at 09:10
  • You have up to 3 minutes of background execution time. you should normally run your background task using some event or from the didEnterBackground delegate method. If you use background fetch then iOS will periodically call fetchNewDataWithCompletionHandler. You don't have any control over how often iOS calls this method but it will use the value you supply to the completion handler to tune its behaviour –  Feb 03 '17 at 09:18
  • exactly you said, But, in my knowledge the background fetch is not a long running task. It will kill after sometime. – Vineesh TP Feb 03 '17 at 09:28
  • sure long running task will drain your battery use network data ( donc it's kind of optimization mechanism ) –  Feb 03 '17 at 09:30
1

you can not launch your app without user action in your ios device because it is restricted by Apple, Now you can use backgroundfetch to open your app in background to do some network call or stuff you want but it is limited to less than a minute mabe upto 30Sec lasts, during that time your network request shoould be completed and all long duration task is scheduled, even during background fect you can update your UI by posting notification on MAIN thread.

Anurag Soni
  • 1,077
  • 10
  • 14