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


Java Criteria.setBearingRequired方法代碼示例

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


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

示例1: getCriteria

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * 設置定位參數
 *
 * @return {@link Criteria}
 */
private static Criteria getCriteria() {
    Criteria criteria = new Criteria();
    // 設置定位精確度 Criteria.ACCURACY_COARSE比較粗略,Criteria.ACCURACY_FINE則比較精細
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    // 設置是否要求速度
    criteria.setSpeedRequired(false);
    // 設置是否允許運營商收費
    criteria.setCostAllowed(false);
    // 設置是否需要方位信息
    criteria.setBearingRequired(false);
    // 設置是否需要海拔信息
    criteria.setAltitudeRequired(false);
    // 設置對電源的需求
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    return criteria;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:LocationUtils.java

示例2: getCriteria

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * 設置定位參數
 *
 * @return {@link Criteria}
 */
private static Criteria getCriteria() {
    Criteria criteria = new Criteria();
    //設置定位精確度 Criteria.ACCURACY_COARSE比較粗略,Criteria.ACCURACY_FINE則比較精細
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    //設置是否要求速度
    criteria.setSpeedRequired(false);
    // 設置是否允許運營商收費
    criteria.setCostAllowed(false);
    //設置是否需要方位信息
    criteria.setBearingRequired(false);
    //設置是否需要海拔信息
    criteria.setAltitudeRequired(false);
    // 設置對電源的需求
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    return criteria;
}
 
開發者ID:tututututututu,項目名稱:BaseCore,代碼行數:22,代碼來源:LocationUtils.java

示例3: setupLocationListener

import android.location.Criteria; //導入方法依賴的package包/類
@SuppressLint("MissingPermission")
private void setupLocationListener() {
    locationListener = new LocationListener();
    locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);

    TIME_TO_UPDATE = Integer.parseInt(sharedPreferences.getString("sync_frequency", "60")) * 1000;

    Criteria criteria = new Criteria();
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(true);
    criteria.setSpeedRequired(false);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setCostAllowed(true);

    bestProvider = locationManager.getBestProvider(criteria, false);

    locationManager.requestLocationUpdates(bestProvider, TIME_TO_UPDATE, DISTANCE_TO_CHANGE, locationListener);
}
 
開發者ID:STUDIO-apps,項目名稱:GeoShare_Android,代碼行數:20,代碼來源:TrackingService.java

示例4: setupLocationChangeListener

import android.location.Criteria; //導入方法依賴的package包/類
@SuppressLint("MissingPermission")
private void setupLocationChangeListener() {
/* SETTING UP LOCATION CHANGE LISTENER */
    locationListener = new LocationListener();
    locationManager = (LocationManager) Application.getContext().getSystemService(Context.LOCATION_SERVICE);
    locationServiceEnabled = locationManager != null && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

    Criteria criteria = new Criteria();
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(true);
    criteria.setSpeedRequired(false);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setCostAllowed(true);

    bestProvider = locationManager.getBestProvider(criteria, false);

    updateFrequency = Integer.parseInt(settingsSharedPreferences.getString("update_frequency", "5")) * 1000;

    locationManager.requestLocationUpdates(bestProvider, updateFrequency, 0, locationListener);
}
 
開發者ID:STUDIO-apps,項目名稱:GeoShare_Android,代碼行數:22,代碼來源:MapsFragment.java

示例5: GeoLocation

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * The constructor of the GeoLocation class and we supplied the Context as a parameter.
 * initialize the application context. Criteria class indicating the application criteria for
 * selecting a location provider. locationManager class provides access to the system location
 * services. These services allow applications to obtain periodic updates of the device's
 * geographical location
 */

public GeoLocation(Context ctx) {
    context = ctx;
    locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        gpsStatus = false;
        return;
    } else {
        gpsStatus = true;
    }
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    provider = locationManager.getBestProvider(criteria, true);
    locationManager.requestLocationUpdates(provider, 5000, 0, this);
}
 
開發者ID:egovernments,項目名稱:egov-mobile,代碼行數:27,代碼來源:GeoLocation.java

示例6: getProvider

import android.location.Criteria; //導入方法依賴的package包/類
private String getProvider(LocationManager locationManager) {
    // 構建位置查詢條件
    Criteria criteria = new Criteria();
    // 查詢精度:高
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    // 速度
    criteria.setSpeedRequired(false);
    // 是否查詢海撥:否
    criteria.setAltitudeRequired(false);
    // 是否查詢方位角:否
    criteria.setBearingRequired(false);
    // 電量要求:低
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    // 返回最合適的符合條件的provider,第2個參數為true說明,如果隻有一個provider是有效的,則返回當前provider
    return locationManager.getBestProvider(criteria, true);
}
 
開發者ID:macouen,項目名稱:lunzi,代碼行數:17,代碼來源:MapLocationUtil.java

示例7: initServices

import android.location.Criteria; //導入方法依賴的package包/類
private void initServices() {
    // sensor manager
    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mOrientationSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);

    // location manager
    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    mLocationProvider = mLocationManager.getBestProvider(criteria, true);

}
 
開發者ID:li-yu,項目名稱:iTester,代碼行數:17,代碼來源:CompassActivity.java

示例8: getCriteria

import android.location.Criteria; //導入方法依賴的package包/類
private Criteria getCriteria() {
    Criteria criteria = new Criteria();
    //設置定位精確度 Criteria.ACCURACY_COARSE比較粗略,Criteria.ACCURACY_FINE則比較精細
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    //設置是否要求速度
    criteria.setSpeedRequired(false);
    // 設置是否允許運營商收費
    criteria.setCostAllowed(false);
    //設置是否需要方位信息
    criteria.setBearingRequired(false);
    //設置是否需要海拔信息
    criteria.setAltitudeRequired(false);
    // 設置對電源的需求
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    return criteria;
}
 
開發者ID:OMNILab,項目名稱:ArubaSyslog,代碼行數:17,代碼來源:GPS_Server.java

示例9: getProviderName

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * Get the best provider name.
 * @return Name of best suiting provider.
 * */
String getProviderName() {
    LocationManager locationManager = (LocationManager) this
            .getSystemService(Context.LOCATION_SERVICE);

    Criteria criteria = new Criteria();
    criteria.setPowerRequirement(Criteria.POWER_HIGH); // Chose your desired power consumption level.
    criteria.setAccuracy(Criteria.ACCURACY_MEDIUM); // Choose your accuracy requirement.
    criteria.setSpeedRequired(true); // Chose if speed for first location fix is required.
    criteria.setAltitudeRequired(false); // Choose if you use altitude.
    criteria.setBearingRequired(false); // Choose if you use bearing.
    criteria.setCostAllowed(true); // Choose if this provider can waste money :-)

    // Provide your criteria and flag enabledOnly that tells
    // LocationManager only to return active providers.
    return locationManager.getBestProvider(criteria, true);
}
 
開發者ID:hyalis,項目名稱:Bouako,代碼行數:21,代碼來源:FormActivity.java

示例10: OrientationManager

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * Initializes a new instance of {@code OrientationManager}, using the specified context to
 * access system services.
 */
public OrientationManager(SensorManager sensorManager, LocationManager locationManager) {
    mRotationMatrix = new float[16];
    mOrientation = new float[9];
    mSensorManager = sensorManager;
    mLocationManager = locationManager;
    mListeners = new LinkedHashSet<OnChangedListener>();

    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setBearingRequired(false);
    criteria.setSpeedRequired(false);

    if (mLocationManager != null) {
    	mLocationProvider = mLocationManager.getBestProvider(criteria, true /* enabledOnly */);
    } else {
    	mLocationProvider = null;
    }
}
 
開發者ID:tomoto,項目名稱:GlassNjslyr,代碼行數:23,代碼來源:OrientationManager.java

示例11: SensorsOrientationManager

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * Initializes a new instance of {@code OrientationManager}, using the specified context to
 * access system services.
 */
public SensorsOrientationManager(SensorManager sensorManager, LocationManager locationManager) {
    mRotationMatrix = new float[16];
    mOrientation = new float[9];
    mSensorManager = sensorManager;
    mLocationManager = locationManager;
    mListeners = new LinkedHashSet<OnChangedListener>();

    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setBearingRequired(true);
    criteria.setSpeedRequired(true);
    criteria.setAltitudeRequired(true);

    mLocationProvider = mLocationManager.getBestProvider(criteria, false);
}
 
開發者ID:euedge,項目名稱:orientation-recorder,代碼行數:20,代碼來源:SensorsOrientationManager.java

示例12: onCreate

import android.location.Criteria; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	initializeGui();
	
       locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
       Criteria criteria = new Criteria();
       criteria.setAccuracy(Criteria.ACCURACY_COARSE); // GPS, Network, others
       criteria.setPowerRequirement(Criteria.POWER_LOW);
       criteria.setAltitudeRequired(false);
       criteria.setBearingRequired(false);
       criteria.setSpeedRequired(false);
       criteria.setCostAllowed(true);
       provider = locationManager.getBestProvider(criteria, true);
}
 
開發者ID:jsfrost,項目名稱:StreetlightSeattleReporter,代碼行數:18,代碼來源:MainActivity.java

示例13: isLocationSharingAvailable

import android.location.Criteria; //導入方法依賴的package包/類
public static boolean isLocationSharingAvailable( Context context ) {

		LocationManager manager = (LocationManager) context.getSystemService( Context.LOCATION_SERVICE );

		if( manager == null ) {
			return false;
		}

		Criteria criteria = new Criteria();
		criteria.setAccuracy( Criteria.ACCURACY_FINE );
		criteria.setAltitudeRequired( false );
		criteria.setBearingRequired( false );
		criteria.setCostAllowed( true );
		criteria.setPowerRequirement( Criteria.NO_REQUIREMENT );

		String provider = manager.getBestProvider( criteria, true );

		if( provider == null || LocationManager.PASSIVE_PROVIDER.equals( provider ) ) {
			return false;
		}

		return true;

	}
 
開發者ID:SilentCircle,項目名稱:silent-text-android,代碼行數:25,代碼來源:LocationUtils.java

示例14: onProviderDisabled

import android.location.Criteria; //導入方法依賴的package包/類
public void onProviderDisabled(String provider) {
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    provider = locationManager.getBestProvider(criteria, true);
    Location location = locationManager.getLastKnownLocation(provider);
    Geolocation geo = convertCoordinates(location);

    List<IGeolocationListener> listeners = ((GeolocationDelegate) AppRegistryBridge.getInstance().getGeolocationBridge().getDelegate()).getListeners();

    if (!listeners.isEmpty()) {
        for (IGeolocationListener l : listeners) {
            l.onWarning(geo, IGeolocationListenerWarning.StaleData);
        }
    }
}
 
開發者ID:AdaptiveMe,項目名稱:adaptive-arp-android,代碼行數:20,代碼來源:LocationListenerImpl.java

示例15: getLocation

import android.location.Criteria; //導入方法依賴的package包/類
public Location getLocation(Activity activity)
{
    LocationManager locationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
    // 查找到服務信息
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE); // 高精度
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW); // 低功耗

    String provider = locationManager.getBestProvider(criteria, false); // 獲取GPS信息
    Location location = locationManager.getLastKnownLocation(provider); // 通過GPS獲取位置
    return location;
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:16,代碼來源:ShareUtil.java


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