Book Image

iOS Development with Xamarin Cookbook

By : Dimitrios Tavlikos (USD)
Book Image

iOS Development with Xamarin Cookbook

By: Dimitrios Tavlikos (USD)

Overview of this book

Table of Contents (22 chapters)
iOS Development with Xamarin Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Location services in the background


In this recipe, we will discuss how to use location services while the app is in the background.

Getting ready

Create a new Single View Application in Xamarin Studio and name it BackgroundLocationApp. Just like we did in the previous recipes, add a label and two buttons on the view of the controller.

How to do it...

Perform the following steps to use the location services when the app is in the background:

  1. In the Solution pane, double-click on the Info.plist file to open it. Under the Source tab, add a new key by clicking on the plus (+) sign or by right-clicking and selecting New Key from the context menu.

  2. Select Required background modes from the drop-down list or just type UIBackgroundModes in the field.

  3. Expand the key and right-click on the empty item below it. Click on New Key in the context menu. In its Value field, select App registers for location updates, or type the word location. Save the document. When done, you should have something similar to the...