当前位置: 首页>>代码示例>>Java>>正文


Java LocationProvider.getPowerRequirement方法代码示例

本文整理汇总了Java中android.location.LocationProvider.getPowerRequirement方法的典型用法代码示例。如果您正苦于以下问题:Java LocationProvider.getPowerRequirement方法的具体用法?Java LocationProvider.getPowerRequirement怎么用?Java LocationProvider.getPowerRequirement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.location.LocationProvider的用法示例。


在下文中一共展示了LocationProvider.getPowerRequirement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: providerInfo

import android.location.LocationProvider; //导入方法依赖的package包/类
private void providerInfo(String provider) {
   LocationProvider info = locationManager.getProvider(provider);
   StringBuilder builder = new StringBuilder();
   builder.append("LocationProvider[")
         .append("name=")
         .append(info.getName())
         .append(",enabled=")
         .append(locationManager.isProviderEnabled(provider))
         .append(",hasMonetaryCost=")
         .append(info.hasMonetaryCost())
         .append(",requiresCell=")
         .append(info.requiresCell())
         .append(",requiresNetwork=")
         .append(info.requiresNetwork())
         .append(",requiresSatellite=")
         .append(info.requiresSatellite())
         .append(",supportsAltitude=")
         .append(info.supportsAltitude())
         .append(",supportsBearing=")
         .append(info.supportsBearing())
         .append(",supportsSpeed=")
         .append(info.supportsSpeed())
 			.append(",getAccuracy=");
   int accuracy = info.getAccuracy();
   if (accuracy > -1) builder.append(A[accuracy]);
   else builder.append("No Data");
   builder.append(",getPowerRequirement=");
   int power = info.getPowerRequirement();
   if (power > -1) builder.append(P[power]);
   else builder.append("No Data");
   builder.append("]");
   Log.i(TAG, builder.toString());
}
 
开发者ID:sussman,项目名称:androidomatic-keyer,代码行数:34,代码来源:GeoHelper.java

示例2: insertDatabaseEntries

import android.location.LocationProvider; //导入方法依赖的package包/类
@Override
	void insertDatabaseEntries() {
		Context context = MyApplication.getAppContext();
		CimonDatabaseAdapter database = CimonDatabaseAdapter.getInstance(context);
		if (!supportedMetric) {
			database.insertOrReplaceMetricInfo(groupId, title, "", NOTSUPPORTED, 0, 0, 
					"", "", Metrics.TYPE_SENSOR);
			return;
		}
		
		float power = 0;
		String description = null;
		List<String> providers = locationManager.getProviders(true);
		for (String provider : providers) {
			LocationProvider locProvider = locationManager.getProvider(provider);
			power += locProvider.getPowerRequirement();
			if (description == null) {
				description = locProvider.getName();
			}
			else {
				description = description + " | " + locProvider.getName();
			}
		}
		// insert metric group information in database
		database.insertOrReplaceMetricInfo(groupId, title, description, 
				SUPPORTED, power, locationManager.getGpsStatus(null).getTimeToFirstFix(), 
				"Global coordinate", "1" + context.getString(R.string.units_degrees), 
				Metrics.TYPE_SENSOR);
		// insert information for metrics in group into database
		database.insertOrReplaceMetrics(Metrics.LOCATION_LATITUDE, groupId, 
				"Latitude", context.getString(R.string.units_degrees), 90);
		database.insertOrReplaceMetrics(Metrics.LOCATION_LONGITUDE, groupId, 
				"Longitude", context.getString(R.string.units_degrees), 180);
		database.insertOrReplaceMetrics(Metrics.LOCATION_ACCURACY, groupId, 
				"Accuracy", context.getString(R.string.units_meters), 500);
//		database.insertOrReplaceMetrics(Metrics.LOCATION_COORDINATE, groupId, 
//				"Coordinate", "", 10);
	}
 
开发者ID:Sean1988,项目名称:CIMON_Android,代码行数:39,代码来源:LocationService.java

示例3: formationLocationProvider

import android.location.LocationProvider; //导入方法依赖的package包/类
public static String formationLocationProvider(Context context,
		LocationProvider provider) {
	String name = provider.getName();
	int horizontalAccuracy = provider.getAccuracy();
	int powerRequirements = provider.getPowerRequirement();
	boolean hasMonetaryCost = provider.hasMonetaryCost();
	boolean requiresCell = provider.requiresCell();
	boolean requiresNetwork = provider.requiresCell();
	boolean requiresSatellite = provider.requiresSatellite();
	boolean supportsAltitude = provider.supportsAltitude();
	boolean supportsBearing = provider.supportsBearing();
	boolean supportsSpeed = provider.supportsSpeed();

	String enableMessage = "UNKNOWN";
	if (context != null) {
		LocationManager lm = (LocationManager) context
				.getSystemService(Context.LOCATION_SERVICE);
		enableMessage = yOrN(lm.isProviderEnabled(name));
	}

	String logMessage = String
			.format("%s | enable:%s | horizontal accuracy:%d | power:%d | "
					+ "cost:%s | uses cell:%s | uses network:%s | uses satellite:%s | "
					+ "has altitude:%s | has bearing:%s | has speed:%s",
					name, enableMessage, horizontalAccuracy,
					powerRequirements, yOrN(hasMonetaryCost),
					yOrN(requiresCell), yOrN(requiresNetwork),
					yOrN(requiresSatellite), yOrN(supportsAltitude),
					yOrN(supportsBearing), yOrN(supportsSpeed));
	return logMessage;
}
 
开发者ID:RockyNiu,项目名称:ToDo,代码行数:32,代码来源:LogHelper.java


注:本文中的android.location.LocationProvider.getPowerRequirement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。