public static final class LocationRequest.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Builder(LocationRequest copy) |
Modifier and Type | Method and Description |
---|---|
LocationRequest.Builder |
addBeaconFilter(BeaconFilter beaconFilter)
Adds a beacon filter to be handled during scan time, otherwise only Situm beacons
will be scanned.
|
LocationRequest.Builder |
addBeaconFilters(java.util.List<BeaconFilter> beaconFilters)
Adds beacon filters to be handled during scan time, otherwise only Situm beacons
will be scanned.
|
LocationRequest.Builder |
autoEnableBleDuringPositioning(java.lang.Boolean autoEnableBleDuringPositioning)
Set if the BLE should be re-enabled during positioning if the ble is used (see
useBle(boolean) . |
LocationRequest |
build() |
LocationRequest.Builder |
buildingIdentifier(java.lang.String buildingIdentifier)
Set the building identifier of the building where you will start positioning.
|
LocationRequest.Builder |
foregroundServiceNotification(Notification foregroundServiceNotification)
Set the notification used if the service is running in foreground.
|
LocationRequest.Builder |
indoorProvider(LocationRequest.IndoorProvider indoorProvider)
Set the indoor location provider.
|
LocationRequest.Builder |
interval(int interval)
Set the desired interval for location updates, in milliseconds.This interval is inexact, the
service will try to obtain location updates for your application at this interval.
|
LocationRequest.Builder |
motionMode(LocationRequest.MotionMode motionMode)
(EXPERIMENTAL) Set the motion mode.
|
LocationRequest.Builder |
outdoorLocationOptions(OutdoorLocationOptions outdoorLocationOptions)
Set outdoor location options.
|
LocationRequest.Builder |
realtimeUpdateInterval(LocationRequest.RealtimeUpdateInterval realtimeUpdateInterval)
Set the interval to upload locations to the realtime.
|
LocationRequest.Builder |
smallestDisplacement(float smallestDisplacement)
Set the minimum displacement between location updates (in meters).
|
LocationRequest.Builder |
useBatterySaver(java.lang.Boolean useBatterySaver)
(EXPERIMENTAL) This option enables battery saving when device is idle and not moving.
|
LocationRequest.Builder |
useBle(boolean useBle)
Set if you want to use BLE for positioning.
|
LocationRequest.Builder |
useCompass(boolean useCompass)
Set if you want to use compass for positioning.
|
LocationRequest.Builder |
useDeadReckoning(boolean useDeadReckoning)
(EXPERIMENTAL) Set if you want to use dead reckoning to get fast position updates using only
the inertial sensors, between the server position updates.
|
LocationRequest.Builder |
useForegroundService(boolean useForegroundService)
Run the service in foreground.
|
LocationRequest.Builder |
useGps(boolean useGps)
(EXPERIMENTAL) Set if you want to use Gps for positioning indoor.
|
LocationRequest.Builder |
useGyro(boolean useGyro)
Set if you want to use gyro for positioning.
|
LocationRequest.Builder |
useWifi(boolean useWifi)
Set if you want to use Wifi for positioning.
|
public Builder()
public Builder(LocationRequest copy)
public LocationRequest.Builder buildingIdentifier(java.lang.String buildingIdentifier)
android.permission.ACCESS_FINE_LOCATION
.
In Android 9 the location does not have modes, is just enabled or disabled but before Android 9 there were three location modes: High accuracy, Battery saving and device only.
To use the indoor-outdoor location the user must set the location mode to High Accuracy. Otherwise the location won't start if the device can't get an outdoor position.
The High Accuracy mode uses GPS, Wi-Fi, Bluetooth and mobile networks to get the location. This mode will return the most accurate location possible
The Battery Saving mode uses Wi-Fi, Bluetooth and mobile networks. It does not use GPS so the positioning won't work because the indoor-outdoor mode needs the GPS signal to be available.
The Device Only mode uses the GPS, so the positioning will not start if there is no GPS signal.
You can know more about the location modes [here](https://developer.android.com/training/location/change-location-settings#location-request)public LocationRequest.Builder interval(int interval)
smallestDisplacement(float)
you may
not receive updates at the desired interval if the other condition isn't met.
useDeadReckoning(boolean)
will be disabled.
Default value is LocationRequest.DEFAULT_INTERVAL
public LocationRequest.Builder indoorProvider(LocationRequest.IndoorProvider indoorProvider)
LocationRequest.IndoorProvider.INPHONE
public LocationRequest.Builder useBle(boolean useBle)
To scan BLE the BLE should be enabled. When the positioning is started the sensor is
enabled automatically. Then, during positioning, if the user disables the BLE it will be re-enabled automatically,
if you want to change this behaviour see autoEnableBleDuringPositioning(Boolean)
.
public LocationRequest.Builder useWifi(boolean useWifi)
public LocationRequest.Builder useCompass(boolean useCompass)
Gyro and compass shouldn't be disabled at the same time.
public LocationRequest.Builder useGyro(boolean useGyro)
Gyro and compass shouldn't be disabled at the same time.
public LocationRequest.Builder useGps(boolean useGps)
android.permission.ACCESS_FINE_LOCATION
.public LocationRequest.Builder motionMode(LocationRequest.MotionMode motionMode)
LocationRequest.MotionMode.BY_FOOT
public LocationRequest.Builder useForegroundService(boolean useForegroundService)
foregroundServiceNotification(Notification)
useForegroundService
- true to run the service in foreground, false otherwisepublic LocationRequest.Builder useDeadReckoning(boolean useDeadReckoning)
public LocationRequest.Builder foregroundServiceNotification(Notification foregroundServiceNotification)
useForegroundService(boolean)
is trueforegroundServiceNotification
- the notification to use running in foregroundpublic LocationRequest.Builder outdoorLocationOptions(OutdoorLocationOptions outdoorLocationOptions)
outdoorLocationOptions
- the outdoor location optionsOutdoorLocationOptions
public LocationRequest.Builder addBeaconFilter(BeaconFilter beaconFilter)
public LocationRequest.Builder addBeaconFilters(java.util.List<BeaconFilter> beaconFilters)
public LocationRequest.Builder useBatterySaver(java.lang.Boolean useBatterySaver)
public LocationRequest.Builder smallestDisplacement(float smallestDisplacement)
LocationRequest.DEFAULT_SMALLEST_DISPLACEMENT
.
interval(int)
you may
not receive updates at the desired interval if the other condition isn't met.
useDeadReckoning(boolean)
will be disabled.smallestDisplacement
- the smallest displacement (in meters) the user must move between location updatespublic LocationRequest.Builder realtimeUpdateInterval(LocationRequest.RealtimeUpdateInterval realtimeUpdateInterval)
realtimeUpdateInterval
- the interval to upload locations to the realtimepublic LocationRequest.Builder autoEnableBleDuringPositioning(java.lang.Boolean autoEnableBleDuringPositioning)
useBle(boolean)
. Default value is true.
The BLE sensor will still be enabled when you start the positioning using BLE.
public LocationRequest build()