Custom Location Source
Passing external GPS location data to the Navigation SDK means that the system's default location provider is no longer used. The SDK will use the location data you provide for route calculation without a starting point and for real-time navigation. It is recommended to pass data at a frequency of once per second; otherwise, navigation accuracy may be affected.
Enable External GPS Data
Call the setIsUseExtraGPSData method of AMapNavi to enable the use of external GPS data.
/**
* Sets whether to use external GPS data.
* This switch must be enabled for the {@link AMapNavi#setExtraGPSData(int, Location)} method to take effect.
*
* @param isUseExtraData Whether to use external GPS data.
* @since 1.7.0
*/
@Override
public void setIsUseExtraGPSData(boolean isUseExtraData)Pass External GPS Data
Call the setExtraGPSData method of AMapNavi to pass external GPS data.
Note: The location data must be in the WGS84 coordinate system (pass 1 for type) or the AMAP coordinate system (pass 2 for type). The following fields are all required: longitude, latitude, speed, accuracy, bearing, and time.
/**
* Sets external GPS data for navigation.
* Call {@link AMapNavi#setIsUseExtraGPSData(boolean)} before using this method.
*
* @param type Coordinate type. Use 1 for system default coordinates, 2 for AMap coordinates.
* @param location External GPS data. Longitude, Latitude, Accuracy, Speed, Bearing, and Time are all required.
* @since 1.9.3
*/
@Override
public void setExtraGPSData(int type, Location location)