How to load and use MapGis

Map loading sequence
 * ① loginfo: map file exists /mnt/sdcard/MapGIS/map/wuhan/wuhan.xml
 * ② loginfo:mapViewWillStartLoadingMap
 * ③ loginfo:mapViewDidFinishLoadingMap
 * ④ loginfo:mapViewDidUpdateHeading0.0//User orientation in map positioning
 * ⑤ loginfo:mapViewZoomChanged_-1.0_0.0
 * ⑥ loginfo:mapViewWillStartRefresh
 * ⑦ loginfo:mapViewDidFinishRefresh
 * ⑧ loginfo:mapViewRenderContextCreated
 * 

 * The last step is mapViewRenderContextCreated, so we should place all map operations after this method.



Test positioning function:

//========Start positioning, pay attention to register the corresponding permissions========
BDLManager bdlManager = BDLManager.getInstance(); 
bdlManager.create(context);
bdlManager.setListener(new MMLocationListener() {

@Override
public void onLocationChanged(Location arg0) {
// TODO Auto-generated method stub
LogUtil.i(logTag, "bdlManager onLocationChanged_"+arg0.getLongitude()+"_"+arg0.getLatitude());
}
});
//setOption(int positioning time interval, boolean need to return address)
bdlManager.setOption(5, false);
bdlManager.start();
//========Start positioning, pay attention to register the corresponding permissions========
BDSManager bdsManager = BDSManager.getInstance(); 
bdsManager.create(context);
bdsManager.setListener(new MMLocationListener() {

@Override
public void onLocationChanged(Location arg0) {
// TODO Auto-generated method stub
LogUtil.i(logTag, "bdsManager onLocationChanged_"+arg0.getLongitude()+"_"+arg0.getLatitude());
}
});
//setOption(int positioning time interval, boolean need to return address)
bdsManager.setOption(5, false);
bdsManager.start();
//========Start positioning, pay attention to register the corresponding permissions========
GPSManager gpsManager = GPSManager.getInstance(); 
gpsManager.create(context);
gpsManager.setListener(new MMLocationListener() {

@Override
public void onLocationChanged(Location arg0) {
// TODO Auto-generated method stub
LogUtil.i(logTag, "gpsManager onLocationChanged_"+arg0.getLongitude()+"_"+arg0.getLatitude());
}
});
//setOption(int positioning time interval, boolean need to return address)
gpsManager.setOption(5, false);
gpsManager.start();


After testing, the BDLManager method cannot be used for positioning, BDSManager and GPSManager can be used for positioning, and only GPS positioning can be used, but mobile network and WiFi positioning cannot be used.


If this is the case, you can customize a servevice and define a management class for positioning service, encapsulate positioning, stop positioning and other operations, implement it tomorrow, and play games today.

Guess you like

Origin blog.csdn.net/u012049463/article/details/50861279