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


Java LocationRequest.setSmallestDisplacement方法代码示例

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


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

示例1: requestLocationUpdates

import com.google.android.gms.location.LocationRequest; //导入方法依赖的package包/类
@Override
public void requestLocationUpdates() {
  LocationRequest request = LocationRequest.create();

  if (interval != null) {
    request.setInterval(interval);
  }
  if (fastestInterval != null) {
    request.setFastestInterval(fastestInterval);
  }
  if (smallestDisplacement != null) {
    request.setSmallestDisplacement(smallestDisplacement);
  }

  updateRequestPriority(request);

  if (googleApiClient.isConnected()) {
    //noinspection MissingPermission
    LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, this);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-events-android,代码行数:22,代码来源:GoogleLocationEngine.java

示例2: createLocationRequest

import com.google.android.gms.location.LocationRequest; //导入方法依赖的package包/类
/**
 * Creating location request object
 */
private void createLocationRequest() {
    mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(UPDATE_INTERVAL);
    mLocationRequest.setFastestInterval(FATEST_INTERVAL);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
}
 
开发者ID:SoftprodigyIndia,项目名称:AndroidAppBoilerplate,代码行数:11,代码来源:LocationTracker.java

示例3: onConnected

import com.google.android.gms.location.LocationRequest; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
  if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
    ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    requestPermission();
    return;
  }
  Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
  if (mLastLocation != null) {
    latLng = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude());
    mMocketClient.pushLatLngToServer(latLng);

    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    currLocationMarker = mGoogleMap.addMarker(markerOptions);
  }

  LocationRequest mLocationRequest = new LocationRequest();
  mLocationRequest.setInterval(5000); //5 seconds
  mLocationRequest.setFastestInterval(3000); //3 seconds
  mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
  mLocationRequest.setSmallestDisplacement(0.1F); //1/10 meter

  LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
 
开发者ID:Nishant-Pathak,项目名称:mocket_android_demo,代码行数:28,代码来源:MapsActivity.java

示例4: buildLR

import com.google.android.gms.location.LocationRequest; //导入方法依赖的package包/类
private LocationRequest buildLR() {
    LocationRequest request = new LocationRequest();
    request.setPriority(mLocationPriority);
    request.setInterval(mLocationInterval);
    request.setFastestInterval(mLocationFastestInterval);
    request.setSmallestDisplacement(mSmallestDisplacement);
    return request;
}
 
开发者ID:MustansirZia,项目名称:react-native-fused-location,代码行数:9,代码来源:FusedLocationModule.java


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