Location

The Airship Cordova plugin provides basic support for location services offered in the Airship SDK.

iOS Setup

For location services to be available in iOS, apps must add a dependency for AirshipLocationKit as well as AirshipKit. This can easily be done by adding the airship-location-cordova Cordova plugin to your project.

Once added, the airship-location-cordova plugin will link AirshipLocationKit and initialize on take off.

Location APIs

Enabling and disabling location features:

// Enable location
UrbanAirship.setLocationEnabled(true)

// Disable location
UrbanAirship.setLocationEnabled(false)

// Enable background location
UrbanAirship.setBackgroundLocationAllowed(true)

// Disable background location
UrbanAirship.setBackgroundLocationAllowed(false)

Querying location enabled status:

// Location enabled
var locationEnabled = UrbanAirship.isLocationEnabled()

// Background location enabled
var backgroundLocationAllowed = UrbanAirship.isBackgroundLocationAllowed()