定位监听
实现方式与系统的定位监听类似,通过MKLocationManager注册或者移除定位监听器:
一般事件监听
在初始化地图Activity时,注册一般事件监听,并实现MKGeneralListener的接口处理相应事件,将mBMapMan.init("我的Key", null)替换为下面的代码:/**
* 常用事件监听,用来处理通常的网络错误,授权验证错误等<BR>
* [功能详细描述]
*/
public static class MyGeneralListener implements MKGeneralListener {
@Override
public void onGetNetworkState(int iError) {
Log.d("MyGeneralListener", "onGetNetworkState error is " + iError);
Toast.makeText(WalktourApp.context.getApplicationContext(),
"您的网络出错啦!",
Toast.LENGTH_LONG).show();
}
@Override
public void onGetPermissionState(int iError) {
Log.d("MyGeneralListener", "onGetPermissionState error is "
+ iError);
if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
// 授权Key错误:
Toast.makeText(WalktourApp.context.getApplicationContext(),
"请在BMapApiDemoApp.java文件输入正确的授权Key!",
Toast.LENGTH_LONG).show();
WalktourApp.context.m_bKeyRight = false;
}
}
}