Java Code Examples for com.baidu.location.LocationClientOption#setProdName()

The following examples show how to use com.baidu.location.LocationClientOption#setProdName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationActivity.java    From Conquer with Apache License 2.0 5 votes vote down vote up
private void initLocClient() {
	// 开启定位图层
	mBaiduMap.setMyLocationEnabled(true);
	mBaiduMap.setMyLocationConfigeration(new MyLocationConfigeration(MyLocationConfigeration.LocationMode.NORMAL,
			true, null));
	// 定位初始化
	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);
	LocationClientOption option = new LocationClientOption();
	option.setProdName("bmobim");// 设置产品线
	option.setOpenGps(true);// 打开gps
	option.setCoorType("bd09ll"); // 设置坐标类型
	option.setScanSpan(1000);
	option.setOpenGps(true);
	option.setIsNeedAddress(true);
	option.setIgnoreKillProcess(true);
	mLocClient.setLocOption(option);
	mLocClient.start();
	if (mLocClient != null && mLocClient.isStarted()) mLocClient.requestLocation();

	if (lastLocation != null) {
		// 显示在地图上
		LatLng ll = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
		MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
		mBaiduMap.animateMapStatus(u);
	}
}
 
Example 2
Source File: LocationUtils.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
private LocationClientOption getLocationClientOption(Context context) {
	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);
	option.setLocationMode(LocationMode.Hight_Accuracy);// 设置定位模式
	option.setCoorType("gcj02");// 返回的定位结果是百度经纬度,默认值gcj02
	option.setScanSpan(1000);// 设置发起定位请求的间隔时间为1000ms
	option.setProdName(context.getPackageName());
	option.setIsNeedAddress(true);
	return option;
}