Module Veery
getCurrentLocation(callback)
Get the last known Location collected by Veery.
This function is fully synchronous, meaning the answer is returned very quickly.
Parameters
callback function
Returns
Locations in JSON object
Android
{ "accuracy" : Double, "altitude" : Double, "bearing" : Double, "elapsedRealtimeNanos" : Double, "latitude" : Double, "longitude" : Double, "provider" : String, "speed" : Double, "time" : Double }
IOS
{ "altitude" : Double, "latitude" : Double, "longitude" : Double, "course" : Double, "speed" : Double, "horizontalAccuracy" : Double, "verticalAccuracy" :Double , "timestamp" : String }
if nil : no Location were collected untill now
Usage / Example
import React, { Component } from 'react'; import {Platform,StyleSheet,Text,Button,View} from 'react-native'; import Veery from 'react-native-veery'; export default class App extends Component<{}> { componentWillMount(){ Veery.serviceConnect(); Veery.setApiKeySecret('SuPeRScrET12345789GhJ'); // Veery.activate(Veery.GEOPROFILE); // Requires react-native-veery 1.4.4 or higher // Veery.activate(Veery.BACKGROUND_GEOLOC | Veery.COLLECT | Veery.ROUTE_MATCH | Veery.POINT_OF_INTEREST | Veery.PREDICTION ); current(){ Veery.requestLocationUpdate(); Veery.getCurrentLocation( (location) => { console.log('getCurrentLocation--longitude', location.longitude); console.log('getCurrentLocation--latitude', location.latitude); } ) } render() { return( <View > <Text > Welcome to VeeryDemoReactNative!</Text> <Button onPress = {this.current} title="currentLocation" color="#8FFF04"/> </View> );} }
User interaction
none
See also
getCurrentLocation()
Get the last known Location collected by Veery.
getCurrentLocationAge()
Available only for Android Platform
Get age (in seconds) of the last known location.
requestLocationUpdate()
Request Veery to be warned when the user has moved.
stopLocationUpdate()
Cancel the call to requestLocationUpdate.
veeryLocationUpdate
Callback triggered when the user has moved.