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

The following examples show how to use com.baidu.location.LocationClientOption#setNeedDeviceDirect() . 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: ShareLocationActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void initLocationClient() {
    locationClient = new LocationClient(getApplicationContext());
    LocationClientOption option = new LocationClientOption();
    option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
    option.setCoorType(CoordinateType.BD09LL);
    option.setIsNeedAddress(true);
    option.setOpenGps(true);
    option.setLocationNotify(true);
    option.setNeedDeviceDirect(true);
    option.setIsNeedLocationDescribe(false);
    option.setIsNeedLocationPoiList(true);
    option.setIgnoreKillProcess(true);
    option.SetIgnoreCacheException(true);
    option.setEnableSimulateGps(true);
    //5s发送一次自己的位置
    option.setScanSpan(5000);
    locationClient.setLocOption(option);
    locationClient.registerLocationListener(this);
    locationClient.start();
}
 
Example 2
Source File: LocationService.java    From Conquer with Apache License 2.0 6 votes vote down vote up
/**
 * 设置定位参数
 *
 * @version 1.0
 * @author zyh
 * @date 2015年2月7日 下午7:32:07
 */
public void InitLocation() {
    try {
        LocationClientOption option = new LocationClientOption();
        option.setLocationMode(LocationMode.Hight_Accuracy);
        option.setOpenGps(true);
        option.setCoorType("bd09ll");// 返回的定位结果是百度经纬度,默认值gcj02
        // option.setScanSpan(1000);// 设置发起定位请求的间隔时间为1000ms
        option.setIsNeedAddress(true);// 返回的定位结果包含地址信息
        option.setNeedDeviceDirect(true);// 返回的定位结果包含手机机头的方向
        mLocationClient.setLocOption(option);
        L.i("初始化完毕");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: MainActivity.java    From nearbydemo with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	txtLocation = (TextView) findViewById(R.id.txtLocation);
	((ZApplication)getApplication()).mLocationResult = txtLocation;
	mLocClient = ((ZApplication) getApplication()).mLocationClient;

	LocationClientOption option = new LocationClientOption();
	option.setLocationMode(LocationMode.Hight_Accuracy);// ���ö�λģʽ
	option.setCoorType("bd09ll");// ���صĶ�λ����ǰٶȾ�γ�ȣ�Ĭ��ֵgcj02
	option.setIsNeedAddress(true);// ���صĶ�λ���������ַ��Ϣ
	option.setNeedDeviceDirect(true);// ���صĶ�λ��������ֻ���ͷ�ķ���
	mLocClient.setLocOption(option);
	
}
 
Example 4
Source File: ClientOptionFactory.java    From RxLocation with Apache License 2.0 5 votes vote down vote up
/***
 * @return Default LocationClientOption
 * 详情请查看{ http://wiki.lbsyun.baidu.com/cms/androidloc/doc/v7.1/index.html }
 */
private LocationClientOption getDefaultLocationClientOption() {
    final LocationClientOption option = new LocationClientOption();
    option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
    option.setIsNeedAddress(true);
    option.setIsNeedLocationDescribe(true);
    option.setNeedDeviceDirect(false);
    option.setLocationNotify(false);
    option.setIgnoreKillProcess(true);
    option.setIsNeedLocationDescribe(true);
    option.setIsNeedLocationPoiList(true);
    option.SetIgnoreCacheException(false);
    option.setIsNeedAltitude(false);
    return option;
}
 
Example 5
Source File: LocationActivity.java    From VSigner with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 初始化选项
 */
private void initLocationClientOption() {
	LocationClientOption option = new LocationClientOption();
	option.setLocationMode(LocationMode.Hight_Accuracy);//设置定位模式
	option.setCoorType("bd09ll");//返回的定位结果是百度经纬度,默认值gcj02
	option.setScanSpan(5000);//设置发起定位请求的间隔时间为5000ms
	option.setIsNeedAddress(true);//返回的定位结果包含地址信息
	option.setNeedDeviceDirect(true);//返回的定位结果包含手机机头的方向
	option.setOpenGps(true);// 打开gps
	option.setIgnoreKillProcess(true);
	mLocationClient.setLocOption(option);
}
 
Example 6
Source File: MainActivity.java    From nearbydemo with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	boolean first = getSharedPreferences("userinfo", Context.MODE_PRIVATE).getBoolean("first", false);

	if (!first) {
		Intent intent = new Intent(this, LoginActivity.class);
		startActivity(intent);
	}

	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	reqQueue = Volley.newRequestQueue(this);
	imageLoader = new ImageLoader(reqQueue, new BitmapLruCache());
	
	
	//百度地图定位
	mLocationClient = new LocationClient(getApplicationContext());//是否有问题??
	mMyLocationListener = new MyLocationListener();
	mLocationClient.registerLocationListener(mMyLocationListener);
	
	
	LocationClientOption option = new LocationClientOption();
	option.setLocationMode(LocationMode.Hight_Accuracy);// 设置定位模式
	option.setCoorType("bd09ll");// 返回的定位结果是百度经纬度,默认值gcj02
	option.setIsNeedAddress(true);// 返回的定位结果包含地址信息
	option.setNeedDeviceDirect(true);// 返回的定位结果包含手机机头的方向
	mLocationClient.setLocOption(option);

}