Location
The Airship Location React Native plugin provides basic support for location services offered in the Airship SDK.
Setup
Using Yarn
yarn add urbanairship-location-react-native
Using NPM
npm install urbanairship-location-react-native --save
Importing the module
import { AirshipLocation } from 'urbanairship-location-react-native'
Location APIs
Enabling and disabling location features
// Enable location
AirshipLocation.setLocationEnabled(true)
// Disable location
AirshipLocation.setLocationEnabled(false)
// Enable background location
AirshipLocation.setBackgroundLocationAllowed(true)
// Disable background location
AirshipLocation.setBackgroundLocationAllowed(false)
Querying location enabled status
// Location enabled
var locationEnabled = AirshipLocation.isLocationEnabled()
// Background location enabled
var backgroundLocationAllowed = AirshipLocation.isBackgroundLocationAllowed()
Feedback
Was this page helpful?
Thank you
Thanks for your feedback!
Tell Us MoreThank you
We will try harder!
Tell Us MoreCategories