本文整理汇总了Java中com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY属性的典型用法代码示例。如果您正苦于以下问题:Java LocationRequest.PRIORITY_HIGH_ACCURACY属性的具体用法?Java LocationRequest.PRIORITY_HIGH_ACCURACY怎么用?Java LocationRequest.PRIORITY_HIGH_ACCURACY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.gms.location.LocationRequest
的用法示例。
在下文中一共展示了LocationRequest.PRIORITY_HIGH_ACCURACY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLocationPriority
@ReactMethod
public void setLocationPriority(int mLocationPriority) {
switch (mLocationPriority) {
case 0:
this.mLocationPriority = LocationRequest.PRIORITY_HIGH_ACCURACY;
break;
case 1:
this.mLocationPriority = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY;
break;
case 2:
this.mLocationPriority = LocationRequest.PRIORITY_LOW_POWER;
break;
case 3:
this.mLocationPriority = LocationRequest.PRIORITY_NO_POWER;
break;
}
}
示例2: onStartCommand
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
mLocationClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mLocationRequest.setInterval(Constants.LOCATION_INTERVAL);
mLocationRequest.setFastestInterval(Constants.FASTEST_LOCATION_INTERVAL);
int priority = LocationRequest.PRIORITY_HIGH_ACCURACY;
mLocationRequest.setPriority(priority);
mLocationClient.connect();
return START_STICKY;
}
示例3: setup
public void setup(final Callback successCallback, final Callback errorCallback,
final int interval, final boolean requestHighAccuracy) {
mInterval = interval;
mErrorCallback = errorCallback;
mSuccessCallback = successCallback;
if (requestHighAccuracy) {
mAccuracy = LocationRequest.PRIORITY_HIGH_ACCURACY;
} else {
mAccuracy = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY;
}
}