Skip to content



StreetHawk's Location component is used for running location based campaigns based on location of your application's user. Also module can be used for calculating the Work and Home locations of your application's user.


StreetHawkLocation component depends on StreetHawk's Analytics components. This document assumes that you have already integrated StreetHawkAnalytics component. if not then click here for detailed documentation on StreetHawkAnalytics components which describes steps to integrate Analytics component.

Integration Steps

  • Include StreetHawkLocation Component

1.In Xamarin Studio, double click on Components folder
2.Click on "Get More Components", and search for StreetHawk Locations. Click Add to App
3.Once downloaded, click on Add to Project

  • Check StreetHawk.IOS.Location.dll reference

Right click project->References->Edit References..., make sure StreetHawk.IOS.Core.dll and StreetHawk.IOS.Location.dll are added to project.

For Unified projects, please add corresponding StreetHawk.IOS.Core-Unified.dll and StreetHawk.IOS.Location-Unified.dll.

  • Modify Info.plist to enable location service

Add NSLocationAlwaysUsageDescription: request “Always” permission. (Option available in iOS 8). This is needed when you use location functions, including "streethawk/Locations" or "streethawk/Geofences" or "streethawk/Beacons".

  • Include Location module

Include StreetHawk component adding following statement:

using StreethawkIOS.Core;
using StreethawkIOS.Location;

Must call at least one function of Location module to make sure link to it. For very simple use case, just add this line:

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
    //Simply call one function of Location module to make sure linking to it.
    SHLocation.instance().isDefaultLocationServiceEnabled = true;
  • Delay asking for Permission

By default StreetHawk library request location permission when call “streethawkinit” in “didFinishLaunchingWithOptions”. In case you may wish to delay asking the user for location permission, you can add the code be as shown below.

//optional to delay ask for permission
SHLocation.instance().isDefaultLocationServiceEnabled = false;  //make streethawkinit not trigger location service, delay for later time.

//do SHApp.instance ().streethawkinit (); and other things.

SHLocation.instance().isLocationServiceEnabled = true;  //later when ready to asking for location service, call this.