Before you begin

This is an iOS class. To complete the coding exercises, you will need a Xamarin.iOS development environment with either a configured iOS Simulator or a device to run the exercise on. Please read the setup requirements if you need help installing the Xamarin development environment.

Overview

After this session you will be able to improve the user experience of your application by allowing an ongoing operation to continue, even if your app is no longer the active one.

Objectives

  1. Understand the iOS Backgrounding Model
  2. Work with Finite-Length Tasks

Lecture

IOS210 - Intro to Backgrounding: Running Finite-Length Tasks

Exercises

Exercise materials are available from GitHub. The code can be cloned through a desktop Git client or downloaded directly as a ZIP file.

  1. Integrate a Finite-Length Task with the application lifecycle
    Exercise
    Apps often have to save state information when leaving the foreground. In this exercise you will learn how to  request enough time from the operating system to complete such an operation.
  2. Code a cancellable Finite-Length Task
    Exercise
    In this exercise you will wrap an ongoing operation into a Finite-Length Task and make the operation cancellable in case the app  runs out of background time.

Additional resources

Xamarin documentation: Backgrounding on iOS Evolve 2014 Training Videos Backgrounding Application programming guide for iOS (Apple)