當前位置: 首頁>>代碼示例>>Java>>正文


Java BDLocation.TypeCriteriaException方法代碼示例

本文整理匯總了Java中com.baidu.location.BDLocation.TypeCriteriaException方法的典型用法代碼示例。如果您正苦於以下問題:Java BDLocation.TypeCriteriaException方法的具體用法?Java BDLocation.TypeCriteriaException怎麽用?Java BDLocation.TypeCriteriaException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.baidu.location.BDLocation的用法示例。


在下文中一共展示了BDLocation.TypeCriteriaException方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    // 在回調方法運行在remote進程
    // 獲取定位類型
    int locType = location.getLocType();
    if (locType == BDLocation.TypeGpsLocation || locType == BDLocation.TypeNetWorkLocation
            || locType == BDLocation.TypeOffLineLocation) {
        // 定位成功。GPS定位結果 || 網絡定位結果 || 離線定位結果
        // 緯度
        mLatitude = String.valueOf(location.getLatitude());
        // 經度
        mLongitude = String.valueOf(location.getLongitude());
        mHandler.sendEmptyMessage(HANDLE_ADDRESS_OK);
    } else if (location.getLocType() == BDLocation.TypeServerError) {
        mHandler.sendEmptyMessage(HANDLE_SERVER_ERROR);
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
        mHandler.sendEmptyMessage(HANDLE_NETWORK_EXCEPTION);
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
        mHandler.sendEmptyMessage(HANDLE_CRITERIA_EXCEPTION);
    }
}
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:22,代碼來源:WBNearbyActivity.java

示例2: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    // 在回調方法運行在remote進程
    // 獲取定位類型
    int locType = location.getLocType();
    if (locType == BDLocation.TypeGpsLocation || locType == BDLocation.TypeNetWorkLocation
            || locType == BDLocation.TypeOffLineLocation) {
        // 定位成功。GPS定位結果 || 網絡定位結果 || 離線定位結果
        // 緯度
        mLatitude = location.getLatitude();
        // 經度
        mLongitude = location.getLongitude();
        // 獲取地址信息
        mAddrStr = location.getAddrStr();
        mHandler.sendEmptyMessage(HANDLE_ADDRESS_OK);
    } else if (location.getLocType() == BDLocation.TypeServerError) {
        mHandler.sendEmptyMessage(HANDLE_SERVER_ERROR);
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
        mHandler.sendEmptyMessage(HANDLE_NETWORK_EXCEPTION);
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
        mHandler.sendEmptyMessage(HANDLE_CRITERIA_EXCEPTION);
    }
}
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:24,代碼來源:WBPostActivity.java

示例3: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public final void onReceiveLocation(BDLocation bdLocation) {
    if (null != bdLocation && bdLocation.getLocType() != BDLocation.TypeServerError) {
        LocationEntity location = new LocationEntity(bdLocation);
        onReceiveLocation(location);
        String errorMsg = null;
        if (bdLocation.getLocType() == BDLocation.TypeServerError) {
            errorMsg = "服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因";
        } else if (bdLocation.getLocType() == BDLocation.TypeNetWorkException) {
            errorMsg = "網絡不同導致定位失敗,請檢查網絡是否通暢";
        } else if (bdLocation.getLocType() == BDLocation.TypeCriteriaException) {
            errorMsg = "無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機";
        }
        if (!TextUtils.isEmpty(errorMsg)) {
            onError(new Throwable(errorMsg));
        }
    } else {
        onError(new Throwable("uncaught exception"));
    }

}
 
開發者ID:yangjiantao,項目名稱:AndroidLocationLib,代碼行數:22,代碼來源:LocationHelper.java

示例4: isValidLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
/**
 * 判斷位置是否可用
 *
 * @param bdLocation
 * @return
 */
public static final boolean isValidLocation(BDLocation bdLocation, BDLocation cashLocation) {
    boolean isValid = false;
    if (bdLocation.getLocType() == BDLocation.TypeGpsLocation) {
        // 當前為GPS定位結果
        isValid = true;
    } else if (bdLocation.getLocType() == BDLocation.TypeNetWorkLocation) {
        // 當前為網絡定位結果
        if (cashLocation == null || !cashLocation.getTime().equals(bdLocation.getTime()))
            isValid = true;
    } else if (bdLocation.getLocType() == BDLocation.TypeOffLineLocation) {
        // 當前為離線定位結果
    } else if (bdLocation.getLocType() == BDLocation.TypeServerError) {
        // 當前網絡定位失敗
        // 可將定位唯一ID、IMEI、定位失敗時間反饋至[email protected]
    } else if (bdLocation.getLocType() == BDLocation.TypeNetWorkException) {
        // 當前網絡不通
    } else if (bdLocation.getLocType() == BDLocation.TypeCriteriaException) {
        // 當前缺少定位依據,可能是用戶沒有授權,建議彈出提示框讓用戶開啟權限
        // 可進一步參考onLocDiagnosticMessage中的錯誤返回碼
    }

    return isValid;
}
 
開發者ID:dreamfish797,項目名稱:LocationProvider,代碼行數:30,代碼來源:BaiduUtils.java

示例5: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    switch (location.getLocType()) {
        case BDLocation.TypeGpsLocation:
        case BDLocation.TypeNetWorkLocation:
        case BDLocation.TypeOffLineLocation:
            getWeather(location.getCity());
            break;
        case BDLocation.TypeServerError:
        case BDLocation.TypeNetWorkException:
        case BDLocation.TypeCriteriaException:
            //如果定位失敗,默認失敗
            getWeather("深圳");
            break;
    }
}
 
開發者ID:aduroidpc,項目名稱:TaskNotepad,代碼行數:17,代碼來源:OneFragment.java

示例6: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(final BDLocation location) {
    String city = location.getCity();
    if (city != null) {
        final String name = city.substring(0, city.length() - 1);
        EventBus.getDefault().post(new CityNameMessage(name));
        Logger.d("發送了");
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {

        Toast.makeText(MyApplication.getAppContext(), "網絡不同導致定位失敗,請檢查網絡是否通暢", Toast.LENGTH_LONG).show();
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {

        Toast.makeText(MyApplication.getAppContext(), "無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機", Toast.LENGTH_LONG).show();
    }

    MyApplication.getmLocationClient().stop();

}
 
開發者ID:byhieg,項目名稱:easyweather,代碼行數:19,代碼來源:MyLocationListener.java

示例7: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location)
{
    //獲取定位結果
    StringBuffer sb = new StringBuffer(256);
    sb.append("time : ");
    sb.append(location.getTime());    //獲取定位時間
    sb.append("\nerror code : ");
    sb.append(location.getLocType());    //獲取類型類型
    sb.append("\nlatitude : ");
    sb.append(location.getLatitude());    //獲取緯度信息
    sb.append("\nlontitude : ");
    sb.append(location.getLongitude());    //獲取經度信息
    sb.append("\nradius : ");
    sb.append(location.getRadius());    //獲取定位精準度
    if (location.getLocType() == BDLocation.TypeGpsLocation)
    {
        // GPS定位結果
        sb.append("\nspeed : ");
        sb.append(location.getSpeed());    // 單位:公裏每小時
        sb.append("\nsatellite : ");
        sb.append(location.getSatelliteNumber());    //獲取衛星數
        sb.append("\nheight : ");
        sb.append(location.getAltitude());    //獲取海拔高度信息,單位米
        sb.append("\ndirection : ");
        sb.append(location.getDirection());    //獲取方向信息,單位度
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());    //獲取地址信息
        sb.append("\ndescribe : ");
        sb.append("gps定位成功");
    }
    else if (location.getLocType() == BDLocation.TypeNetWorkLocation)
    {
        // 網絡定位結果
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());    //獲取地址信息
        sb.append("\noperationers : ");
        sb.append(location.getOperators());    //獲取運營商信息
        sb.append("\ndescribe : ");
        sb.append("網絡定位成功");
    }
    else if (location.getLocType() == BDLocation.TypeOffLineLocation)
    {
        // 離線定位結果
        sb.append("\ndescribe : ");
        sb.append("離線定位成功,離線定位結果也是有效的");
    }
    else if (location.getLocType() == BDLocation.TypeServerError)
    {
        sb.append("\ndescribe : ");
        sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
    }
    else if (location.getLocType() == BDLocation.TypeNetWorkException)
    {
        sb.append("\ndescribe : ");
        sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
    }
    else if (location.getLocType() == BDLocation.TypeCriteriaException)
    {
        sb.append("\ndescribe : ");
        sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");

    }
    sb.append("\nlocationdescribe : ");
    sb.append(location.getLocationDescribe());    //位置語義化信息
    List<Poi> list = location.getPoiList();    // POI數據
    if (list != null) {
        sb.append("\npoilist size = : ");
        sb.append(list.size());
        for (Poi p : list)
        {
            sb.append("\npoi= : ");
            sb.append(p.getId() + " " + p.getName() + " " + p.getRank());
        }
    }
    //移動到用戶當前位置
    moveToMe(location);
}
 
開發者ID:WindFromFarEast,項目名稱:SmartButler,代碼行數:79,代碼來源:LocationActivity.java

示例8: displayLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
private void displayLocation(HooweLocation location, TextView textView) {
        StringBuffer sb = new StringBuffer(256);
        sb.append("time : ");
        /**
         * 時間也可以使用systemClock.elapsedRealtime()方法 獲取的是自從開機以來,每次回調的時間;
         * location.getTime() 是指服務端出本次結果的時間,如果位置不發生變化,則時間不變
         */
        sb.append(location.getLocTime());
        sb.append("\nlocType : ");// 定位類型
        sb.append(location.getLocType());
        sb.append("\nlocType description : ");// *****對應的定位類型說明*****
        sb.append(location.getLocationDescribe());
        sb.append("\nlatitude : ");// 緯度
        sb.append(location.getLatitude());
        sb.append("\nlontitude : ");// 經度
        sb.append(location.getLongitude());
//                sb.append("\nradius : ");// 半徑
//                sb.append(location.getRadius());
//                sb.append("\nCountryCode : ");// 國家碼
//                sb.append(location.getCountryCode());
        sb.append("\nCountry : ");// 國家名稱
        sb.append(location.getCountry());
//                sb.append("\ncitycode : ");// 城市編碼
//                sb.append(location.getCityCode());
        sb.append("\ncity : ");// 城市
        sb.append(location.getCity());
//                sb.append("\nDistrict : ");// 區
//                sb.append(location.getDistrict());
//                sb.append("\nStreet : ");// 街道
//                sb.append(location.getStreet());
        sb.append("\naddr : ");// 地址信息
        sb.append(location.getAddrStr());
//                sb.append("\nUserIndoorState: ");// *****返回用戶室內外判斷結果*****
//                sb.append(location.getUserIndoorState());
        sb.append("\nDirection(not all devices have value): ");
        sb.append(location.getDirection());// 方向
        sb.append("\nlocationdescribe: ");
        sb.append(location.getLocationDescribe());// 位置語義化信息
//                sb.append("\nPoi: ");// POI信息
//                if (location.getPoiList() != null && !location.getPoiList().isEmpty()) {
//                    for (int i = 0; i < location.getPoiList().size(); i++) {
//                        Poi poi = (Poi) location.getPoiList().get(i);
//                        sb.append(poi.getName() + ";");
//                    }
//                }
        if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位結果
            sb.append("\nspeed : ");
            sb.append(location.getSpeed());// 速度 單位:km/h
            sb.append("\nsatellite : ");
            sb.append(location.getSatelliteNumber());// 衛星數目
//                    sb.append("\nheight : ");
//                    sb.append(location.getAltitude());// 海拔高度 單位:米
//                    sb.append("\ngps status : ");
//                    sb.append(location.getGpsAccuracyStatus());// *****gps質量判斷*****
            sb.append("\ndescribe : ");
            sb.append("gps定位成功");
        } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 網絡定位結果
            // 運營商信息
//                    if (location.hasAltitude()) {// *****如果有海拔高度*****
//                        sb.append("\nheight : ");
//                        sb.append(location.getAltitude());// 單位:米
//                    }
            sb.append("\noperationers : ");// 運營商信息
            sb.append(location.getOperators());
            sb.append("\ndescribe : ");
            sb.append("網絡定位成功");
        } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 離線定位結果
            sb.append("\ndescribe : ");
            sb.append("離線定位成功,離線定位結果也是有效的");
        } else if (location.getLocType() == BDLocation.TypeServerError) {
            sb.append("\ndescribe : ");
            sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
        } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
            sb.append("\ndescribe : ");
            sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
        } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
            sb.append("\ndescribe : ");
            sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
        }
        logMsg(sb.toString(), textView);
    }
 
開發者ID:dreamfish797,項目名稱:LocationProvider,代碼行數:82,代碼來源:MainActivity.java

示例9: analysisLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
private static StringBuffer analysisLocation(HooweLocation location) {
    StringBuffer sb = new StringBuffer(256);
    sb.append("time : ");
    /**
     * 時間也可以使用systemClock.elapsedRealtime()方法 獲取的是自從開機以來,每次回調的時間;
     * location.getTime() 是指服務端出本次結果的時間,如果位置不發生變化,則時間不變
     */
    sb.append(location.getLocTime());
    sb.append("\nlocType : ");// 定位類型
    sb.append(location.getLocType());
    sb.append("\nlocType description : ");// *****對應的定位類型說明*****
    sb.append(location.getLocationDescribe());
    sb.append("\nlatitude : ");// 緯度
    sb.append(location.getLatitude());
    sb.append("\nlontitude : ");// 經度
    sb.append(location.getLongitude());
    sb.append("\nradius : ");// 半徑
    sb.append(location.getRadius());
    sb.append("\nCountryCode : ");// 國家碼
    sb.append(location.getCountryCode());
    sb.append("\nCountry : ");// 國家名稱
    sb.append(location.getCountry());
    sb.append("\ncitycode : ");// 城市編碼
    sb.append(location.getCityCode());
    sb.append("\ncity : ");// 城市
    sb.append(location.getCity());
    sb.append("\nDistrict : ");// 區
    sb.append(location.getDistrict());
    sb.append("\nStreet : ");// 街道
    sb.append(location.getStreet());
    sb.append("\naddr : ");// 地址信息
    sb.append(location.getAddrStr());
    sb.append("\nDirection(not all devices have value): ");
    sb.append(location.getDirection());// 方向
    sb.append("\nlocationdescribe: ");
    sb.append(location.getLocationDescribe());// 位置語義化信息

    if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位結果
        sb.append("\nspeed : ");
        sb.append(location.getSpeed());// 速度 單位:km/h
        sb.append("\nsatellite : ");
        sb.append(location.getSatelliteNumber());// 衛星數目
        sb.append("\nheight : ");
        sb.append(location.getAltitude());// 海拔高度 單位:米
        sb.append("\ndescribe : ");
        sb.append("gps定位成功");
    } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 網絡定位結果
        // 運營商信息
        sb.append("\noperationers : ");// 運營商信息
        sb.append(location.getOperators());
        sb.append("\ndescribe : ");
        sb.append("網絡定位成功");
    } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 離線定位結果
        sb.append("\ndescribe : ");
        sb.append("離線定位成功,離線定位結果也是有效的");
    } else if (location.getLocType() == BDLocation.TypeServerError) {
        sb.append("\ndescribe : ");
        sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
        sb.append("\ndescribe : ");
        sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
        sb.append("\ndescribe : ");
        sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
    }
    return sb;
}
 
開發者ID:dreamfish797,項目名稱:LocationProvider,代碼行數:68,代碼來源:LocationUtils.java

示例10: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    //Receive Location
    StringBuffer sb = new StringBuffer(256);
    sb.append("time : ");
    sb.append(location.getTime());
    sb.append("\nerror code : ");
    sb.append(location.getLocType());
    sb.append("\nlatitude : ");
    sb.append(location.getLatitude());
    sb.append("\nlontitude : ");
    sb.append(location.getLongitude());
    sb.append("\nradius : ");
    sb.append(location.getRadius());
    if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位結果
        sb.append("\nspeed : ");
        sb.append(location.getSpeed());// 單位:公裏每小時
        sb.append("\nsatellite : ");
        sb.append(location.getSatelliteNumber());
        sb.append("\nheight : ");
        sb.append(location.getAltitude());// 單位:米
        sb.append("\ndirection : ");
        sb.append(location.getDirection());// 單位度
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());
        sb.append("\ndescribe : ");
        sb.append("gps定位成功");

    } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 網絡定位結果
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());
        //運營商信息
        sb.append("\noperationers : ");
        sb.append(location.getOperators());
        sb.append("\ndescribe : ");
        sb.append("網絡定位成功");
    } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 離線定位結果
        sb.append("\ndescribe : ");
        sb.append("離線定位成功,離線定位結果也是有效的");
    } else if (location.getLocType() == BDLocation.TypeServerError) {
        sb.append("\ndescribe : ");
        sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
        sb.append("\ndescribe : ");
        sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
        sb.append("\ndescribe : ");
        sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
    }
    sb.append("\nlocationdescribe : ");
    sb.append(location.getLocationDescribe());// 位置語義化信息
    List<Poi> list = location.getPoiList();// POI數據
    if (list != null) {
        sb.append("\npoilist size = : ");
        sb.append(list.size());
        for (Poi p : list) {
            sb.append("\npoi= : ");
            sb.append(p.getId() + " " + p.getName() + " " + p.getRank());
        }
    }
    Log.e("BaiduLocationApiDem", sb.toString());
}
 
開發者ID:REBOOTERS,項目名稱:AndroidAnimationExercise,代碼行數:63,代碼來源:MyLocationListener.java

示例11: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
        public void onReceiveLocation(BDLocation location) {
            // TODO Auto-generated method stub
            if (null != location && location.getLocType() != BDLocation.TypeServerError) {
                String time = location.getTime();
                double lat = location.getLatitude();
                double lng = location.getLongitude();
                String address = location.getAddrStr() + ", " + lat + "," + lng;
//                String address = lat + "," + lng;
                switch (operationSealSwitch) {
                    case STATE_OPERATION_LOCK: //上封
                        lockTime.setText(time);
                        lockLocation.setText(address);
                        break;
                    case STATE_OPERATION_UNLOCK: //解封
                        unlockTime.setText(time);
                        unlockLocation.setText(address);
                        break;
                    case STATE_OPERATION_SETTING: //配置
                        coordinateSetting = lat + "," + lng;
                        break;
                }
            } else if (null != location && location.getLocType() == BDLocation.TypeServerError) {
                switch (operationSealSwitch) {
                    case STATE_OPERATION_LOCK: //上封
                        lockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                    case STATE_OPERATION_UNLOCK: //解封
                        unlockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                }
            } else if (null != location && location.getLocType() == BDLocation.TypeNetWorkException) {
                switch (operationSealSwitch) {
                    case STATE_OPERATION_LOCK: //上封
                        lockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                    case STATE_OPERATION_UNLOCK: //解封
                        unlockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                }
            } else if (null != location && location.getLocType() == BDLocation.TypeCriteriaException) {
                switch (operationSealSwitch) {
                    case STATE_OPERATION_LOCK: //上封
                        lockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                    case STATE_OPERATION_UNLOCK: //解封
                        unlockLocation.setText(getString(R.string.fail_get_current_location));
                        break;
                }
            }

            isLocationServiceStarting = false;
        }
 
開發者ID:agenthun,項目名稱:ESeal,代碼行數:54,代碼來源:NfcDeviceFragment.java

示例12: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location)
{
	//Receive Location
	StringBuffer sb = new StringBuffer(256);
	sb.append("time : ");
	sb.append(location.getTime());
	sb.append("\nerror code : ");
	sb.append(location.getLocType());
	sb.append("\nlatitude : ");
	sb.append(location.getLatitude());
	sb.append("\nlontitude : ");
	sb.append(location.getLongitude());
	sb.append("\nradius : ");
	sb.append(location.getRadius());
	if (location.getLocType() == BDLocation.TypeGpsLocation)
	{// GPS定位結果
		sb.append("\nspeed : ");
		sb.append(location.getSpeed());// 單位:公裏每小時
		sb.append("\nsatellite : ");
		sb.append(location.getSatelliteNumber());
		sb.append("\nheight : ");
		sb.append(location.getAltitude());// 單位:米
		sb.append("\ndirection : ");
		sb.append(location.getDirection());// 單位度
		sb.append("\naddr : ");
		sb.append(location.getAddrStr());
		sb.append("\ndescribe : ");
		sb.append("gps定位成功");

	} else if (location.getLocType() == BDLocation.TypeNetWorkLocation)
	{// 網絡定位結果
		sb.append("\naddr : ");
		sb.append(location.getAddrStr());
		//運營商信息
		sb.append("\noperationers : ");
		sb.append(location.getOperators());
		sb.append("\ndescribe : ");
		sb.append("網絡定位成功");
	} else if (location.getLocType() == BDLocation.TypeOffLineLocation)
	{// 離線定位結果
		sb.append("\ndescribe : ");
		sb.append("離線定位成功,離線定位結果也是有效的");
	} else if (location.getLocType() == BDLocation.TypeServerError)
	{
		sb.append("\ndescribe : ");
		sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
	} else if (location.getLocType() == BDLocation.TypeNetWorkException)
	{
		sb.append("\ndescribe : ");
		sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
	} else if (location.getLocType() == BDLocation.TypeCriteriaException)
	{
		sb.append("\ndescribe : ");
		sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
	}
	sb.append("\nlocationdescribe : ");
	sb.append(location.getLocationDescribe());// 位置語義化信息
	List<Poi> list = location.getPoiList();// POI數據
	if (list != null)
	{
		sb.append("\npoilist size = : ");
		sb.append(list.size());
		for (Poi p : list)
		{
			sb.append("\npoi= : ");
			sb.append(p.getId() + " " + p.getName() + " " + p.getRank());
		}
	}
	Log.i("BaiduLocationApiDem", sb.toString());
	Log.d("loveMe", location.getCityCode());
	cityName = location.getCity().replace("市","");

}
 
開發者ID:k91191,項目名稱:bocaiWeather,代碼行數:75,代碼來源:BaiduLocate.java

示例13: receiveLocationShowMessage

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
/**
     * 參數:location
     * 輸出:location中的詳細的位置信息
     */
    public String receiveLocationShowMessage(BDLocation location) {
        setLocation(location);
        longitude = location.getLongitude();           //經度
        latitude = location.getLatitude();             //緯度
        radius = location.getRadius();          //精度
        address = location.getAddrStr();
        this.latLng = new LatLng(latitude, longitude);
        //StringBuilder sb = new StringBuilder(256);
//        sb.append("經度:");
//        sb.append(longitude);
//        sb.append(";緯度:");
//        sb.append(latitude);
//        sb.append(";精度:");
//        sb.append(radius);
//        sb.append("米");
//        sb.append("\n錯誤代碼:");
//        sb.append(location.getLocType());
        if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位結果
            isLocateSuccess = true;
            isGPSLocation = true;
            latLngList.add(latLng);
            locateMode = "GPS定位";
//            sb.append(";GPS定位成功");
//            sb.append("\n速度:");
//            sb.append(location.getSpeed());// 單位:公裏每小時
//            sb.append("km/s");
//            sb.append(";星數:");
//            sb.append(location.getSatelliteNumber());
//            sb.append("顆;海拔:");
//            sb.append(location.getAltitude());// 單位:米
//            sb.append(";角度:");
//            sb.append(location.getDirection());// 單位度
//            sb.append("\n地址:");
//            sb.append(location.getAddrStr());
        } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 網絡定位結果
            isLocateSuccess = true;
            isGPSLocation = false;
            locateMode = "網絡定位";
//            sb.append(";網絡定位成功");
//            sb.append("\n運營商:");
//            sb.append(location.getOperators());
//            sb.append("\n地址:");
//            sb.append(location.getAddrStr());
        } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 離線定位結果
            isLocateSuccess = true;
            isGPSLocation = false;
            //  sb.append("\n離線定位成功,離線定位結果也是有效的");
        } else if (location.getLocType() == BDLocation.TypeServerError) {
            isLocateSuccess = false;
            isGPSLocation = false;
            //  sb.append("\n服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
        } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
            isLocateSuccess = false;
            isGPSLocation = false;
            //  sb.append("\n網絡不同導致定位失敗,請檢查網絡是否通暢");
        } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
            isLocateSuccess = false;
            isGPSLocation = false;
            //  sb.append("\n無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
        }
        // sb.toString();
        return "success";
    }
 
開發者ID:bitkylin,項目名稱:MapForTour,代碼行數:68,代碼來源:DeviceMessageApplication.java

示例14: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
		public void onReceiveLocation(BDLocation location) {
			DebugLog.d(TAG, "------------>>> onReceiveLocation()");
			
			//如果此時沒有網絡了,就停止掉
			//雖然開始的時候判斷了網絡,但是網絡有可能變化
			if (!Environment.getInstance().isNetworkAvailable()) {
				stop();
				update(null);
				return;
			}
			
			if (null == location) { 
				return;
			} else {
				if (location.getLocType() == BDLocation.TypeCriteriaException
						|| location.getLocType() == BDLocation.TypeNetWorkException
						|| location.getLocType() == BDLocation.TypeServerError
						|| location.getLocType() == BDLocation.TypeNone) { 
					return;
				}
			}
			
			final XAddress address = new XAddress();
			
			double latitude = location.getLatitude();
			if (0 != latitude) {
				address.setLatitude("" + latitude);
			}
			
			double longitude = location.getLongitude();
			if (0 != longitude) {
				address.setLongtitude("" + longitude);
			}
			
			String province = location.getProvince();
			if (null != province && !"".equals(province.trim())) {
				address.setProvince(province);
			}
			
			String city = location.getCity();
			if (null != province && !"".equals(province.trim())) {
				address.setCity(city);
			}
			
			String district = location.getDistrict();
			if (null != province && !"".equals(province.trim())) {
				address.setArea(district);
			}
			
			String street = location.getStreet();
			if (null != province && !"".equals(province.trim())) {
				address.setStreet(street);
			}
			
			String addressName = location.getAddrStr();
			if (null != addressName && !"".equals(addressName.trim())) {
				address.setAddressName(addressName);
			}
			
			if ((0 != latitude) && (0 != longitude) && (null != addressName && !"".equals(addressName.trim()))) {
				update(address); 
				//stop();
			} else { 
				return;
			}
			
/*			if ((0 != longitude) && (0 != longitude) && (null != addressName && !"".equals(addressName.trim()))) {
			    ThreadPoolManager.EXECUTOR.execute(new Runnable() {	                
	                @Override
	                public void run() {
	                    splitAddressName(address);
	                }
	            });
			} else { 
				return;
			}*/
		}
 
開發者ID:leleliu008,項目名稱:Newton_for_Android_AS,代碼行數:79,代碼來源:BaiduLocateManager.java

示例15: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
	// BDLocation類封裝了定位sdk的定位結果
    // Receive Location
    StringBuffer sb = new StringBuffer(256);
    sb.append("time : ");
    sb.append(location.getTime());
    sb.append("\nerror code : ");
    sb.append(location.getLocType());
    sb.append("\nlatitude : ");
    sb.append(location.getLatitude());
    sb.append("\nlontitude : ");
    sb.append(location.getLongitude());
    sb.append("\nradius : ");
    sb.append(location.getRadius());
    if (location.getLocType() == BDLocation.TypeGpsLocation){// GPS定位結果
        sb.append("\nspeed : ");
        sb.append(location.getSpeed()); // 單位:公裏每小時
        sb.append("\nsatellite : ");
        sb.append(location.getSatelliteNumber());
        sb.append("\nheight : ");
        sb.append(location.getAltitude()); // 單位:米
        sb.append("\ndirection : ");
        sb.append(location.getDirection()); // 單位度
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());
        sb.append("\ndescribe : ");
        sb.append("gps定位成功");
 
    } else if (location.getLocType() == BDLocation.TypeNetWorkLocation){// 網絡定位結果
        sb.append("\naddr : ");
        sb.append(location.getAddrStr());
        // 運營商信息
        sb.append("\noperationers : ");
        sb.append(location.getOperators());
        sb.append("\ndescribe : ");
        sb.append("網絡定位成功");
    } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 離線定位結果
        sb.append("\ndescribe : ");
        sb.append("離線定位成功,離線定位結果也是有效的");
    } else if (location.getLocType() == BDLocation.TypeServerError) {
        sb.append("\ndescribe : ");
        sb.append("服務端網絡定位失敗,可以反饋IMEI號和大體定位時間到[email protected],會有人追查原因");
    } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
        sb.append("\ndescribe : ");
        sb.append("網絡不同導致定位失敗,請檢查網絡是否通暢");
    } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
        sb.append("\ndescribe : ");
        sb.append("無法獲取有效定位依據導致定位失敗,一般是由於手機的原因,處於飛行模式下一般會造成這種結果,可以試著重啟手機");
    }
    sb.append("\nlocationdescribe : ");
    sb.append(location.getLocationDescribe()); // 位置語義化信息
    List<Poi> list = location.getPoiList(); // POI數據
    if (list != null) {
        sb.append("\npoilist size = : ");
        sb.append(list.size());
        for (Poi p : list) {
            sb.append("\npoi= : ");
            sb.append(p.getId() + " " + p.getName() + " " + p.getRank());
        }
    }
    LogUtil.i(sb.toString());
    
    Location myLocation = new Location();
    myLocation.setLongitude(location.getLongitude());
    myLocation.setLatitude(location.getLatitude());
    myLocation.setAddress(location.getAddrStr());
    myLocation.setAddressDes(location.getLocationDescribe());
    mLocationListener.onReceiveLocation(myLocation);
}
 
開發者ID:weiwosuoai,項目名稱:sniff_wifi,代碼行數:71,代碼來源:LocationManager.java


注:本文中的com.baidu.location.BDLocation.TypeCriteriaException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。