Module Veery
requestPredictionUpdate()
Request Veery to be warned when a new prediction is computed by the backend.
This could be used to refresh a Maps.
Parameters
none
Returns
Void
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.PREDICTION ); } prediction(){ Veery.requestPredictionUpdate();// Add this Veery.getNextTrip( (prediction) =>{ if (prediction !== null) { console.log('prediction App.js==prediction.isOK()===> end',prediction.isOK()); if (prediction.isOK()) { console.log('prediction App.js==prediction.isOutdated()===> end',prediction.isOutdated()); console.log('prediction App.js==prediction.getProbability()===> end',prediction.getProbability()); } } }); } render() { return( <View > <Text > Welcome to VeeryDemoReactNative!</Text> <Button onPress = {this.prediction} title="Prediction" color="#8FFF04"/> </View> );} }
User interaction
none
See also
getNextTrip
Get the next estimated trip for that user.
requestPredictionUpdate
Request for a callback event when a new prediction is computed by the Veery Backend.
stopPredictionUpdate
Cancel the call to requestPredictionUpdate.
Predictions.isOK
Return true if a prediction is in the Cache.
Predictions.isOutdated
Return true if the prediction is outdated (made previously, but now concerns a time in the past)
Predictions.getProbability
Get the level of certainty of the predictive algorithm.
Predictions.getDestinationLongitude getDestinationLatitude
Get the coordinates of the next predicted destination
Predictions.getTrip toGeojson
Get the next predicted trip in GeoJSON format.
Predictions.toLocations
Get the next trip in the form of a Location array.
Predictions.getStartTrip
Get the next start point of the prediction.
Predictions.getStartTime
Get the estimated start time predicted for the next trip.
Predictions.getStartName
Get the name (street name) of the predicted departure place.
Predictions.getArrivalTime
Get the estimated arrival time predicted for the next trip.
Predictions.getArrivalTimeUTC
Get the estimated arrival time predicted for the next trip (returns EPOCH). Only for Android Platform
Predictions.getArrivalName
Get the name (street name) of the predicted arrival place.
veeryPredictionUpdate
Callback triggered every time a new prediction is computed by the Veery backend.