GeoLocation

The GeoLocation API provides the current position.

//with npm
npm install @capacitor/geolocation


Usage

transition({
	type: MOBILE_GPS,
	onData: (coordinates) => {
        console.log(`Current position: ${JSON.stringify(coordinates)}`)
    }
})


API

ID Next States Description
MOBILE_GPS MOBILE_ON_LOADED This transition is to track the current position.


name type default description
onData callback The callback which provides coordinates


iOS

//Apple requires privacy descriptions to be specified in Info.plist for location information: NSLocationAlwaysUsageDescription (Privacy - Location Always Usage Description) NSLocationWhenInUseUsageDescription (Privacy - Location When In Use Usage Description)

Android

//This API requires the following permissions be added to your AndroidManifest.xml ```