-
Notifications
You must be signed in to change notification settings - Fork 1
API Documentation & Usage Guide Android
- Start predict.io - Start getting callbacks from predict.io.
- Stop predict.io - Stop getting callbacks from predict.io.
- Get predict.io status - Check status of predict.io, whether it is active or not.
- Get the device identifier - An alphanumeric string that uniquely identifies a device to predict.io.
- predict.io Search - Enable/disable searching in perimeter for parking.
- predict.io Precision Status - Shows whether predict.io is active in high precision mode or low precision mode.
This starts predict.io if the API_Key is set into plugin.xml, otherwise it returns an Error.
/**
* Starts predict.io if API_Key is set into plugin.xml, otherwise it returns an Error
*
* @param "true/false" set high precision
* @param "true/false" set searching in perimeter enable
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'start' , ['true/false' , 'true/false']);
This method stop predict.io
/**
* Stop predict.io
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'stop', []);
This method returns predict.io's status, PredictIOStatus (i.e. if it is active or not).
/**
* This method returns predict.io's status, PredictIOStatus (i.e. if it is active or not).
*
* @return PredictIOStatus which represents the current predict.io state.
* ACTIVE: predict.io is in a working/running state.
* LOCATION_DISABLED: predict.io is not in a working state, GPS is disabled from location settings.
* AIRPLANE_MODE_ENABLED: predict.io is not in a working state, Airplane mode is enabled in settings.
* INSUFFICIENT_PERMISSION: predict.io has not been authorized by user to use location services at any time.
* IN_ACTIVE: predict.io has not been started. It is in inactive state.
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'status' , []);
An alphanumeric string that uniquely identifies a device to predict.io.
/**
* An alphanumeric string that uniquely identifies a device to the predict.io
*
* @return UUID
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'deviceIdentifier' , []);
Use this method to enable/disable searching in perimeter.
/**
* Enable/disable searching for parking
*
* @return "true/false"
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'isSearchingInPerimeterEnabled' , []);
Use this method to verify if predict.io is active in high precision mode or low precision mode
/**
* Use this method to verify if predict.io is active in high precision mode or low precision mode
*
* @return "HIGH\LOW"
*/
cordova.exec(successCallback , errorCallback , 'PredictIOPlugin' , 'precision' , []);
- Departed - Invoked when the user has just departed.
- Departure Canceled - Invoked when the last departure event is unable to validate.
- Transportation Mode - Invoked when transportation mode is detected.
- Arrival Suspected - Invoked when predict.io suspects that the user has just arrived.
- Arrived - Invoked when the user has just arrived at the destination.
- Searching In Perimeter - Invoked when the user is searching for a parking space at a specific location.
- Did Update Location - Invoked when new location information is received from location services.
###Details
This method is invoked when predict.io detects that the user has just departed
/**
* This method is invoked when predict.io detects that the user has just departed
* from his location and have started a new trip
*
* @param departureLatitude: The latitude of the Location from where the user departed
* @param departureLongitude: The longitude of the Location from where the user departed
* @param departureTime: Start time of the trip
* @param transportMode: Mode of transport
* @param UUID: Trip segment UUID
*/
function departed(param) { }
This method is invoked when predict.io is unable to validate the last departure event.
/**
* This method is invoked when predict.io is unable to validate the last departure event.
* This can be due to invalid data received from sensors or the trip amplitude.
* i.e. If the trip takes less than 5 minutes or the distance travelled is less than 1km
*/
function departureCanceled() { }
This method is invoked when predict.io detects a transportation mode
/**
* This method is invoked when predict.io detects transportation mode
* @param transportationMode: Mode of transportation
* @param UUID: Trip segment UUID
*/
function transportationMode(param) { }
This method is invoked when predict.io suspects that the user has just arrived
/**
* This method is invoked when predict.io suspects that the user has just arrived
* at his location and have ended a trip
* Most of the time it is followed by a confirmed arrived event
* If you need only confirmed arrival events, use arrived method (below) instead
*
* @param departureLatitude: The latitude of the Location from where the user departed
* @param departureLongitude: The longitude of the Location from where the user departed
* @param arrivalLatitude: The latitude of the Location where the user arrived and ended the trip
* @param arrivalLongitude: The longitude of the Location where the user arrived and ended the trip
* @param departureTime: Start time of the trip
* @param arrivalTime: Stop time of the trip
* @param transportMode: Mode of transport
* @param UUID: Trip segment UUID
*/
function arrivalSuspected(param) { }
This method is invoked when predict.io detects that the user has just arrived at destination.
/**
* This method is invoked when predict.io detects that the user has just arrived at destination
*
* @param arrivalLatitude: The latitude of the Location where the user arrived and ended the trip
* @param arrivalLongitude: The longitude of the Location where the user arrived and ended the trip
* @param departureLatitude: The latitude of the Location from where the user departed
* @param departureLongitude: The longitude of the Location from where the user departed
* @param departureTime: Start time of the trip
* @param arrivalTime: Stop time of the trip
* @param transportMode: Mode of transport
* @param UUID: Trip segment UUID
*/
function arrived(param) { }
This method is invoked when predict.io detects that the user is searching for a parking space at a specific location in his/her car.
/**
* This method is invoked when predict.io detects that the user is searching for a
* parking space at a specific location
* @param latitude: The latitude of the Location where predict.io identifies that user is searching for a parking space
* @param longitude: The longitude of the Location where predict.io identifies that user is searching for a parking space
*/
function searchingInPerimeter(param) { }
This method is invoked when new location information is received from location services
/**
* This is invoked when new location information is received from GPS
* Implemented this method if you need raw GPS data, instead of creating new location manager
* Since, it is not recommended using multiple location managers in a single app
* @param latitude: The latitude of the new location received from GPS
* @param longitude: The longitude of the new location received from GPS
*/
function didUpdateLocation(param) { }