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


Java Criteria.setSpeedRequired方法代碼示例

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


在下文中一共展示了Criteria.setSpeedRequired方法的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: 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

示例6: LocationSensor

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * Creates a new LocationSensor component.
 *
 * @param container  ignored (because this is a non-visible component)
 */
public LocationSensor(ComponentContainer container) {
  super(container);
  handler = new Handler();
  // Set up listener
  container.$form().registerForOnResume(this);
  container.$form().registerForOnStop(this);

  // Initialize location-related fields
  Context context = container.$context();
  geocoder = new Geocoder(context);
  locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
  locationCriteria = new Criteria();
  locationCriteria.setSpeedRequired(true);
  myLocationListener = new MyLocationListener();
}
 
開發者ID:roadlabs,項目名稱:alternate-java-bridge-library,代碼行數:21,代碼來源:LocationSensor.java

示例7: GeoHelper

import android.location.Criteria; //導入方法依賴的package包/類
public GeoHelper(Context context) {
	//Constructor
	Log.i(TAG, "Initialize GeoHelper.");
	mContext = context;
	
	locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
	
	listAllProviders();
	criteria = new Criteria();
   	criteria.setAccuracy(Criteria.ACCURACY_COARSE);
   	criteria.setAltitudeRequired(false);
   	criteria.setCostAllowed(false);
   	criteria.setPowerRequirement(Criteria.POWER_LOW);
   	criteria.setSpeedRequired(false);
	
	chooseBestProvider();
   
}
 
開發者ID:sussman,項目名稱:androidomatic-keyer,代碼行數:19,代碼來源:GeoHelper.java

示例8: getBestProvider

import android.location.Criteria; //導入方法依賴的package包/類
/**
 * 獲取以下條件下,最合適的provider
 */
private void getBestProvider() {
    Criteria criteria = new Criteria();
    // 精度高
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    // 低消耗
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    // 海拔
    criteria.setAltitudeRequired(true);
    // 速度
    criteria.setSpeedRequired(true);
    // 費用
    criteria.setCostAllowed(false);
    String provider = locationManager.getBestProvider(criteria, false); //false是指不管當前適配器是否可用
    this.bestProviderTV.setText(provider);
}
 
開發者ID:CaMnter,項目名稱:AndroidLife,代碼行數:19,代碼來源:LocationManagerActivity.java

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

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

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

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

示例13: onAccurateProvider

import android.location.Criteria; //導入方法依賴的package包/類
public void onAccurateProvider() {
	Criteria criteria = new Criteria();

	criteria.setAccuracy(Criteria.ACCURACY_FINE);
	criteria.setSpeedRequired(true);
	criteria.setAltitudeRequired(true);

	LocationManager lm = (LocationManager) getActivity().getSystemService(
			Context.LOCATION_SERVICE);

	List<String> matchingProvideNames = lm.getProviders(criteria, false);
	for (String providerName : matchingProvideNames) {
		LocationProvider provider = lm.getProvider(providerName);
		String logMessage = LogHelper.formationLocationProvider(
				getActivity(), provider);
		Log.d(_logTag, logMessage);
	}
}
 
開發者ID:RockyNiu,項目名稱:ToDo,代碼行數:19,代碼來源:ToGoFragment.java

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

示例15: startListening

import android.location.Criteria; //導入方法依賴的package包/類
public void startListening(Context context){
	if (GPSManager.locationManager == null){
			GPSManager.locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
	}
         
	final Criteria criteria = new Criteria();
         
	criteria.setAccuracy(Criteria.ACCURACY_FINE);
	criteria.setSpeedRequired(true);
        //criteria.setAltitudeRequired(false);
        //criteria.setBearingRequired(false);
        //criteria.setCostAllowed(true);
        //criteria.setPowerRequirement(Criteria.POWER_LOW);
         
	final List<String> providers = GPSManager.locationManager.getProviders(criteria, true);
	Log.d(TAG, "Providers: " + providers);

	for (final String provider : providers){
		GPSManager.locationManager.requestLocationUpdates(provider, GPSManager.gpsMinTime,
				GPSManager.gpsMinDistance, GPSManager.locationListener);
	}
}
 
開發者ID:RomanRipp,項目名稱:Glassware-Speedometer,代碼行數:23,代碼來源:GPSManager.java


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