Build GPS provide steps and information
1. Recording KML files with Gps2googleearth
2. kml file
2.1 Resolution of latitude and longitude
<LineString>
<coordinates>113.89668,22.95283,0 113.89659,22.95281,0113.89665,22.95287</coordinates>
</LineString>
113.89668 is longitude, 22.95274 is dimension, 0 is altitude
3. GPS provide
3.1. Principle Analysis
Build a GPS provider to send location information obtained by extracting latitude from the KML file
3.2. Key code
Build Locationmanager
Locationmanager Mlocationmanager = (locationmanager) getsystemservice (Context.location_service);
Add GPS provide
Mlocationmanager.addtestprovider (Mockgpsprovider.gps_mock_provider,false, False,false, False, True, True, True, 0, 5) ;
Set up GPS provide available
Mlocationmanager.settestproviderenabled (mockgpsprovider.gps_mock_provider,true);
Building a location
Location location = NewLocation (Gps_mock_provider);
Set up dimensions
Location.setlatitude (LAT);
Set longitude
Location.setlongitude (LNG);
Provide location information
Mlocationmanager.settestproviderlocation (gps_mock_provider,location);
3.3. Note Information
When using this simulation GPS provide, the device must first disable the GPS provide so that the simulated GPS provide can be effective
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android build GPS provide steps and information