本文整理汇总了Java中com.baidu.location.Poi类的典型用法代码示例。如果您正苦于以下问题:Java Poi类的具体用法?Java Poi怎么用?Java Poi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Poi类属于com.baidu.location包,在下文中一共展示了Poi类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onReceiveLocation
import com.baidu.location.Poi; //导入依赖的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.Poi; //导入依赖的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.Poi; //导入依赖的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.Poi; //导入依赖的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.Poi; //导入依赖的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.Poi类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论