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


Java BDLocation.getPoiList方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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());
            }
        }
        Log.i("BaiduLocationApiDem", sb.toString());
//        new MainActivity().messages.setText(sb.toString()+"");
        EventBus.getDefault().post(new FirstEvent(location));
    }
 
開發者ID:Room3,項目名稱:Retrofitdemo,代碼行數:63,代碼來源:MyLocationListener.java


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