In this recipe, we will discuss how to use location services while the app is in the background.
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.
Perform the following steps to use the location services when the app is in the background:
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.Select Required background modes from the drop-down list or just type
UIBackgroundModes
in the field.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...