@Override protected void configWebSettings() { super.configWebSettings(); latitude = LBSServiceGaode.getLatitude(); longitude = LBSServiceGaode.getLongitude(); LogUtil.d(TAG, "configWebSettings latitude=" + latitude + " longitude" + longitude); new Thread( new Runnable() { @Override public void run() { configUrl(); } }) .start(); LogUtil.d(TAG, "start progress."); mHandler.sendEmptyMessage(MSG_SHOW_DIALOG_ACTION); mHandler.sendEmptyMessageDelayed(MSG_DISMISS_TIMEDOUT_ACTION, TIMEDOUT); }
@Override public void onLocationChanged(String city, double latitude, double longitude, long time) { LBSServiceGaode.deactivate(); this.latitude = latitude; this.longitude = longitude; mUrl += "&lat=" + String.valueOf(latitude) + "&lng=" + String.valueOf(longitude); LogUtil.d(TAG, "onLocationChanged mUrl=" + mUrl); // modify by lisheng 2014-11-19 loadUrl(mUrl); // modify by lisheng end }
@Override public void onLocationFailed() { LBSServiceGaode.deactivate(); latitude = 0; longitude = 0; mUrl += "&lat=" + String.valueOf(latitude) + "&lng=" + String.valueOf(longitude); LogUtil.d(TAG, "onLocationFailed mUrl=" + mUrl); // modify by lisheng 2014-11-19 loadUrl(mUrl); // modify by lisheng end }
private void configUrl() { if (!TextUtils.isEmpty(mUrl)) { /* * 每次进入定位影响加载效率,改为十分钟超时 才重新定位,不然则取上一次定位信息 * update by hyl 2014-8-14 * old code : * if(latitude == LBSServiceGaode.DEFAULT_LATITUDE || latitude == 0) { LBSServiceGaode.activate(ContactsApp.getInstance(), this); } else { mUrl+="&lat="+String.valueOf(latitude)+"&lng="+String.valueOf(longitude); } */ LBSServiceGaode.process_activate(ContactsApp.getInstance(), this); // update by hyl 2014-8-14 LogUtil.d(TAG, "url=" + mUrl); } }
@Override protected void onDestroy() { LBSServiceGaode.deactivate(); super.onDestroy(); }