| CLASS info |
| public class LocationRequest implements IMessageEntity |
| Location request information class. |
| Return type | Method name | Description |
| Creator<LocationRequest> | CREATOR | LocationRequest builder. |
| Type | Name | Desc |
| int | PRIORITY_HIGH_ACCURACY | Used to request the most accurate location. |
| int | PRIORITY_BALANCED_POWER_ACCURACY | Used to request the block-level location. |
| int | PRIORITY_LOW_POWER | Used to request the city-level location. |
| int | PRIORITY_NO_POWER | Used to request the location with the optimal accuracy without additional power consumption. |
| int | PRIORITY_HD_ACCURACY | Used to request the high-precision location information. Currently, this parameter is available only for the requestLocationUpdatesEx API. |
| Return type | Method name |
| LocationRequest | create() |
| LocationRequest | setPriority(int priority) |
| LocationRequest | setInterval(long millis) |
| LocationRequest | setNumUpdates(int numUpdates) |
| LocationRequest | setFastestInterval(long millis) |
| boolean | isFastestIntervalExplicitlySet() |
| LocationRequest | setExpirationTime(long millis) |
| LocationRequest | setExpirationDuration(long millis) |
| LocationRequest | setSmallestDisplacement(float smallestDisplacement) |
| LocationRequest | setMaxWaitTime(long millis) |
| LocationRequest | setNeedAddress(boolean needAddress) |
| LocationRequest | setLanguage(String language) |
| LocationRequest | setCountryCode(String countryCode) |
| Constant |
| public static final int PRIORITY_HIGH_ACCURACY |
| Used to request the most accurate location. Constant value: 100 |
| Constant |
| public static final int PRIORITY_BALANCED_POWER_ACCURACY |
| Used to request the block-level location. Constant value: 102 |
| Constant |
| public static final int PRIORITY_LOW_POWER |
| Used to request the city-level location. Constant value: 104 |
| Constant |
| public static final int PRIORITY_NO_POWER |
| Used to request the location with the optimal accuracy without additional power consumption. Constant value: 105 |
| Method |
| public LocationRequest create() |
| This API is used to build a location request. |
Parameters
| Parameter name | Parameter desc |
| priority | Request priority. The default value is 100. |
Parameters
| Parameter name | Parameter desc |
| millis | Callback interval, in milliseconds. The default value is 3600000. |
| Method |
| public LocationRequest setNumUpdates(int numUpdates) |
| This API is used to set the number of location updates. If the value is 3, three location updates are sent to the client. |
Parameters
| Parameter name | Parameter desc |
| numUpdates | Number of requested location updates. The default value is Integer.MAX_VALUE. |
Parameters
| Parameter name | Parameter desc |
| millis | Shortest request interval, in milliseconds. The default value is 600000. If another app initiates a location request, the location is also reported to the app at the interval specified in fastestInterval. |
| Method |
| public boolean isFastestIntervalExplicitlySet() |
| This API is used to specify whether to use the shortest interval. |
Return
| Parameter name | Parameter desc |
| boolean | Indicates whether to use the shortest interval. If yes, the value true is returned. Otherwise, the value false is returned. |
Parameters
| Parameter name | Parameter desc |
| millis | Request expiration time, in milliseconds. The default value is Long.MAX_VALUE. |
Parameters
| Parameter name | Parameter desc |
| millis | Request expiration duration, in milliseconds. The default value is Long.MAX_VALUE. |
Parameters
| Parameter name | Parameter desc |
| smallestDisplacement | Minimum displacement between location updates, in meters. The default value is 0. |
| Method |
| public LocationRequest setMaxWaitTime(long millis) |
| This API is used to set the maximum waiting time. |
Parameters
| Parameter name | Parameter desc |
| millis | Maximum waiting time. |
| Method |
| public LocationRequest setNeedAddress(boolean needAddress) |
This API is used to specify whether to return the address information |
Parameters
| Parameter name | Parameter desc |
| needAddress | Indicates whether to return the address information. The default value is false. |
| Method |
| public LocationRequest setLanguage(String language) |
| This API is used to set the language. |
Parameters
| Parameter name | Parameter desc |
| language | Language. The value consists of two letters and complies with the ISO 639-1 international standard. By default, the value is empty. |
| Method |
| public LocationRequest setCountryCode(String countryCode) |
| This API is used to set the country code. |
Parameters
| Parameter name | Parameter desc |
| countryCode | Country code. The value consists of two letters and complies with the ISO 3166-1 international standard. By default, the value is empty. |