iOS - Background Transfer Service for Auto Update data at fixed intervel - ios

I am developing an app of feeds, that fetches feed from server and display to users for read. It working fine when app starts but i want to load data in background when is suspended or terminate(in both case). As we can create IntentService in android and with a AlarmManager we can start that service after a every fixed hours (for ex. 3 hours), so whenever user comes to online he will be able to see latest data without waiting fetch for new feeds.
I have read Background Transfer Service & NSURLSession with silent remote notification but i could not understand how this will help me to achieve my objective.
When getting a remote notification how can i resume a NSURLSessionDataTask form AppDelegate.m file because we can't use delegate there.
Please help me to sort out this issue. Googling from last 2 days but didn't get success to achieve this.

You need to use Background Fetch instead of Background Transfer. Main purpose of Background Transfer is uploading or downloading files while when app in background state.

Related

Fetching data in a background and sending notification in iOS

What I want to do is: when my app is running in the background, I want to fetch data from API, every, let's say, 5 minutes. If some data changed I want to send a notification to the user. Is something like that possible in Swift? My problem is that I don't know how to run code in the background. I looked up background fetch but it looks like it was not made for this purpose (I can't be sure it will be fired after x amount of time with this). My app will be mostly user opening it once, setting some settings and then leave it in the background for notifications and never open it again. Any suggestions on what I can use for this purpose? I'd like to avoid creating a backend that will send data to the app, if possible.

How to periodically call to a webservice even when the app is in background?

I want to do some server pulling in my iOS app. It something like this. When m app installed it should start a background service to check weather is there any new data available since the last updated date. If yeas my app should start a local push notification. How can I do this? I want to know how I can periodically check is there any new data available in server even when my app is in background.
Please help me.
Thanks
On iOS 7 and above, you have Background App Refresh. It's covered in the documentation under Fetching Small Amounts of Content Opportunistically. You can read more about it under Use Background App Refresh.
One caveat is that the user can turn off Background App Refresh for your app.

Mailcore2 on background

I'm using Mailcore2 for an app that im developing by myself, and everything is perfect with Mailcore but now I'm trying to retrieve the emails when the user minimize the app (enter on background), I tried using background notifications but didn't work because time between the close and the first window to enter on my background function is too long.
So I tried to keep the idleOperation working when the user minimize the app but sometimes work perfect and sometime don't work at all.
Anyone have a solution to this?
I'm using Xcode and iOS 8.
Thanks.
The time slice provided by iOS for background fetch is based on an algorithm unknown to the developers.
If you want to use the IMAP IDLE operation, then you will have to start inside the performFetchWithCompletionHandler: and make sure you are done before the app goes to sleep again i.e. anything from a few seconds to max 30 seconds.
I would suggest creating an IMAP session as soon as you enter background, poll IMAP for new changes, process and go to sleep ASAP. But again, iOS decides when and how long you get that time slice for background fetch.
UPDATED ANSWER:
If requirement is just getting the notifications for new emails, then just register for push notifications on your app and push them from your server or use services like Pushwoosh.

ios - Bulding an app that have push notification appear on a specific time interval

I'm building my first application.
I'm making app where I'm doing some fetching from rss feed of web site and loading it to a TableView. What I want is next:
-to inform a user when new feed arrive, when my app is closed (user can set the time interval of update frequency in app settings page) - with Local Notification
I'm using NSURLSession for downloading data, storing it with Core Data, and want the Deployment Target to be iOS 7.1.
Just want to know is it possible and steps that I need to do to implement it correctly.
What you want is called Background Fetch. Background fetch can fetch data from your servers even when the app is not running.
Local notifications would be of no help here. Even when a local notification has been fired, user will have to click on it to fetch data.
Look it up. There is a pretty decent tutorial here.

Background fetch and background transfers in iOS to download data (JSON) on bakcground

I am in the process of upgrading one of my apps to iOS 7 and thought of trying out the new multitasking apis. I am planning to use Background Fetching or Silent push notifications to keep my content uptodate. Basically set of JSON values. Most of the documentation/code I looked through download videos or images and I have following questions...
If we use Background Fetching or Silent push notifications, do we need to download data using a separate backgroundSessionConfiguration ? Or can we do this by utilizing existing defaultSessionConfiguration ? (Because I can reuse the existing method rather than having a separate method for background downloads).
Is it possible to use background transfers to download large set of data other than file assets ?
As I know background background fetch only allows about 1 minute to complete the task , is it possible to use a background transfer inside the fetch to extend that period ? ( I mean, if we start a background transfer inside that background fetch request does the app execute it and complete the job. Or does run it incrementally like pause it and resume it when the app is woken again).
NSUrlSession supports background fetching of Files only. That is an important consideration in your design.
1) Yes, you need to create a session configuration for background downloads.
2) Not unless you download the data to a file then read the file
3) Background fetch can also be done incrementally in chunks if you find you are hitting a time limit. Though the time it takes to download usually isn't counted, just your processing of it.

Resources