Module Veery
activate(Int)
Turn the Veery agent into the geolocation mode required by your application (foreground, background, geo-predictive, ...).
If not called, the geolocation (and the Veery agent) will remain inactive.
From react-native version 1.5.0 you can replace the call to "activate" by a call to activateWithOptin
Parameters
Param name | Type | Usage |
---|---|---|
mode | int | Veery.DEACTIVATE_ALL : Veery will turn off as well as the geolocation proceses. |
Veery.FOREGROUND_GEOLOC : Veery will turn on with geolocation active only when the app is in foreground. (Requires react-native Veery 1.4.4 or higher) | ||
Veery.BACKGROUND_GEOLOC : Veery will turn on with geolocation active also when the app is in background. (Requires react-native Veery 1.4.4 or higher) | ||
Veery.COLLECT : Veery will be connected to the backend for historization. (Requires react-native Veery 1.4.4 or higher) | ||
Veery.ROUTE_MATCH : Veery will receive trips computations. (Requires react-native Veery 1.4.4 or higher) | ||
Veery.POINT_OF_INTEREST : Veery will receive Point of interest. (Requires react-native Veery 1.4.4 or higher) | ||
Veery.PREDICTION : Veery will receive Predictions. (Requires react-native Veery 1.4.4 or higher) | ||
------------------- BACKWARD COMPATIBILITY (older than react-native Veery 1.4.4) | ||
Veery.FOREGROUND : This is equivalent to Veery.FOREGROUND_GEOLOC | ||
Veery.BACKGROUND : This is equivalent to Veery.BACKGROUND_GEOLOC | ||
Veery.BACKEND : This is equivalent to BACKGROUND + Veery.COLLECT + Veery.ROUTE_MATCH | ||
Veery.GEOPROFILE : This is equivalent to BACKEND + Veery.POINT_OF_INTEREST + Veery.PREDICTION |
Note
If Backend Services is requested without Geolocation mode the Veery.BACKGROUND_GEOLOC is used by default.
Returns
Void
Usage / Example
import React, { Component } from 'react'; import {Platform,StyleSheet,Text,Button,View,AppState} 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 Veery.activate(Veery.BACKGROUND_GEOLOC | Veery.COLLECT | Veery.ROUTE_MATCH | Veery.POINT_OF_INTEREST | Veery.PREDICTION); //OR Veery.activate(Veery.BACKGROUND_GEOLOC + Veery.COLLECT + Veery.ROUTE_MATCH + Veery.POINT_OF_INTEREST + Veery.PREDICTION); } } render() { return( <View > <Text > Welcome to VeeryDemoReactNative!</Text> </View> );} }
User interaction
Veery.Forground and Higher : if not previously given by the user, it will request the necessary authorization to get Geolocation
Veery.BACKEND and Higher : if not previsously given by the user, it will request the necessary authorization to use Notifications.