Tizen Native API
5.5
|
This Location Manager API provides functions for obtaining information related to geographical location. This API provides functions to acquire information related to the current position. Notifications on events like service becoming enabled or disabled, new position data being available and others can also be acquired.
#include <locations.h>
The Location Manager API provides functions to acquire information about geographical location, including both as accurate a current position as possible, and receiving notification of changes in position, crossing boundary "fences", and velocity changes detected by the device. The related Geolocation API can be used to convert the location to a physical address. Notifications can be received about the following events:
1. Create location manager ( location_manager_create() )
2. Set callbacks and other required information
3. Start service with location_manager_start()
4. Wait until state change callback ( location_service_state_changed_cb() ) is called with LOCATIONS_SERVICE_ENABLED as first argument
5. Other callbacks are working now, wait for events and process
6. Stop service with location_manager_stop()
7. Wait until state change callback ( location_service_state_changed_cb() ) is called with LOCATIONS_SERVICE_DISABLED as first argument
8. Destroy location manager ( location_manager_destroy() )
After stopping the location service for a given location manager, the location manager can still be used. So some functions can be called if they do not require a location service running on your device. The location service can be re-started later. If a location manager is no longer needed and is going to be destroyed, it is not mandatory to call location_manager_stop(), as location_manager_destroy() will call it automatically. Note that after a location manager has been destroyed, the handle (location_manager_h) can be reused - location_manager_create() can be called again for this handle. In other words, the state before creation and after destruction can be treated as the same state.
This API is related with the following features:
Functions | |
bool | location_manager_is_supported_method (location_method_e method) |
Checks whether the given location method is available. | |
int | location_manager_is_enabled_method (location_method_e method, bool *enable) |
Checks whether the given location method is enabled or not on setting. | |
int | location_manager_enable_method (const location_method_e method, const bool enable) |
Enables the given location method. | |
int | location_manager_create (location_method_e method, location_manager_h *manager) |
Creates a new location manager. | |
int | location_manager_destroy (location_manager_h manager) |
Releases the location manager. | |
int | location_manager_request_single_location (location_manager_h manager, int timeout, location_updated_cb callback, void *user_data) |
Requests to update current location once. | |
int | location_manager_start (location_manager_h manager) |
Starts the location service. | |
int | location_manager_stop (location_manager_h manager) |
Stops the location service. | |
int | location_manager_add_boundary (location_manager_h manager, const location_bounds_h bounds) |
Adds bounds for a given location manager. | |
int | location_manager_remove_boundary (location_manager_h manager, const location_bounds_h bounds) |
Deletes bounds for a given location manager. | |
int | location_manager_foreach_boundary (location_manager_h manager, location_bounds_cb callback, void *user_data) |
Retrieves all location bounds by invoking a specific callback for each location bounds. | |
int | location_manager_get_method (location_manager_h manager, location_method_e *method) |
Gets the given location manager's method. | |
int | location_manager_get_position (location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp) |
Gets the current position information. | |
int | location_manager_get_location (location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp) |
Gets the current position information. | |
int | location_manager_get_velocity (location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp) |
Gets the current velocity information. | |
int | location_manager_get_accuracy (location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical) |
Gets the current accuracy information. | |
int | location_manager_get_last_position (location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp) |
Gets the last position information which is recorded. | |
int | location_manager_get_last_location (location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp) |
Gets the last location information. | |
int | location_manager_get_last_velocity (location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp) |
Gets the last velocity information which is recorded. | |
int | location_manager_get_last_accuracy (location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical) |
Gets the last accuracy information which is recorded. | |
int | location_manager_get_accessibility_state (location_accessibility_state_e *state) TIZEN_DEPRECATED_API |
Gets the current application's location accessibility status. | |
int | location_manager_set_position_updated_cb (location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data) |
Registers a callback function to be invoked at defined interval with updated position information. | |
int | location_manager_unset_position_updated_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_velocity_updated_cb (location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data) |
Registers a callback function to be invoked at defined interval with updated velocity information. | |
int | location_manager_unset_velocity_updated_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_service_state_changed_cb (location_manager_h manager, location_service_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the location service state is changed. | |
int | location_manager_unset_service_state_changed_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_zone_changed_cb (location_manager_h manager, location_zone_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the previously set boundary area is entered or left. | |
int | location_manager_unset_zone_changed_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_setting_changed_cb (location_method_e method, location_setting_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the location setting is changed. | |
int | location_manager_unset_setting_changed_cb (location_method_e method) |
Unregisters the callback function. | |
int | location_manager_get_distance (double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance) |
Gets the distance in meters between two locations. | |
int | location_manager_set_distance_based_location_changed_cb (location_manager_h manager, location_changed_cb callback, int interval, double distance, void *user_data) |
Registers a callback function to be invoked at minimum interval or minimum distance with updated position information. | |
int | location_manager_unset_distance_based_location_changed_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_location_changed_cb (location_manager_h manager, location_changed_cb callback, int interval, void *user_data) |
Registers a callback function to be invoked at defined interval with updated location information. | |
int | location_manager_unset_location_changed_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_set_location_batch_cb (location_manager_h manager, location_batch_cb callback, int batch_interval, int batch_period, void *user_data) |
Registers a callback function to be invoked when batch_period is expired. | |
int | location_manager_unset_location_batch_cb (location_manager_h manager) |
Unregisters the callback function. | |
int | location_manager_start_batch (location_manager_h manager) |
Starts the location batch service. | |
int | location_manager_stop_batch (location_manager_h manager) |
Stops the location batch service. | |
int | location_manager_foreach_location_batch (location_manager_h manager, location_batch_get_location_cb callback, void *user_data) |
Retrieves all location information by invoking a specific callback for each location data. | |
int | location_manager_is_enabled_mock_location (bool *enabled) |
Checks whether the mock location is enabled. | |
int | location_manager_enable_mock_location (const bool enable) |
Enables mock location. | |
int | location_manager_set_mock_location (location_manager_h manager, const double latitude, const double longitude, const double altitude, const double speed, const double direction, const double accuracy) |
Sets a mock location for the given location method. | |
int | location_manager_clear_mock_location (location_manager_h manager) |
Clears a mock location. | |
int | location_manager_set_fused_mode (location_manager_h manager, location_fused_mode_e mode) |
Changes behavior of the location source selection in the fused location method. | |
Typedefs | |
typedef struct location_manager_s * | location_manager_h |
The location manager handle. | |
typedef void(* | location_position_updated_cb )(double latitude, double longitude, double altitude, time_t timestamp, void *user_data) |
Called at defined interval with updated position information. | |
typedef void(* | location_velocity_updated_cb )(double speed, double direction, double climb, time_t timestamp, void *user_data) |
Called at defined interval with updated velocity information. | |
typedef void(* | location_updated_cb )(location_error_e error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double direction, double climb, void *user_data) |
Called at defined interval with updated location information. | |
typedef void(* | location_service_state_changed_cb )(location_service_state_e state, void *user_data) |
Called when the state of location service is changed from enabled to disabled or vice versa. | |
typedef void(* | location_zone_changed_cb )(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data) |
Called when the user-defined zones are entered or exited. | |
typedef void(* | location_setting_changed_cb )(location_method_e method, bool enable, void *user_data) |
Called when the state of location method is changed. | |
typedef bool(* | location_bounds_cb )(location_bounds_h bounds, void *user_data) |
Called once for each location bound. | |
typedef void(* | location_changed_cb )(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data) |
Called at defined interval with updated location information. | |
typedef void(* | location_batch_cb )(int num_of_location, void *user_data) |
Called when the batch interval is expired. | |
typedef bool(* | location_batch_get_location_cb )(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data) |
Gets iteratively to receive location batch data. |
typedef void(* location_batch_cb)(int num_of_location, void *user_data) |
Called when the batch interval is expired.
[in] | num_of_location | The number of location batch data |
[in] | user_data | The user data passed from the callback registration function |
typedef bool(* location_batch_get_location_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data) |
Gets iteratively to receive location batch data.
[in] | latitude | The updated latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The updated longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The updated altitude (meters) |
[in] | speed | The updated speed (km/h) |
[in] | direction | The updated direction (in degrees from the north) |
[in] | horizontal | The horizontal accuracy (meters) |
[in] | vertical | The vertical accuracy (meters) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | user_data | The user data passed from the callback registration function |
true
to continue with the next iteration of the loop, otherwise false
to break out of the loop typedef bool(* location_bounds_cb)(location_bounds_h bounds, void *user_data) |
Called once for each location bound.
[in] | bounds | The location bounds handle |
[in] | user_data | The user data passed from the callback registration function |
true
to continue with the next iteration of the loop, otherwise false
to break out of the loop typedef void(* location_changed_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data) |
Called at defined interval with updated location information.
[in] | latitude | The updated latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The updated longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The updated altitude (meters) |
[in] | speed | The updated speed (km/h) |
[in] | direction | The updated direction (in degrees from the north) |
[in] | horizontal_accuracy | The horizontal accuracy (meters) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | user_data | The user data passed from the callback registration function |
typedef struct location_manager_s* location_manager_h |
The location manager handle.
typedef void(* location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data) |
Called at defined interval with updated position information.
[in] | latitude | The updated latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The updated longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The updated altitude (meters) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | user_data | The user data passed from the call registration function |
typedef void(* location_service_state_changed_cb)(location_service_state_e state, void *user_data) |
Called when the state of location service is changed from enabled to disabled or vice versa.
[in] | state | The service state |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* location_setting_changed_cb)(location_method_e method, bool enable, void *user_data) |
Called when the state of location method is changed.
[in] | method | The method changed on setting |
[in] | enable | The setting value changed |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* location_updated_cb)(location_error_e error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double direction, double climb, void *user_data) |
Called at defined interval with updated location information.
[in] | error | LOCATIONS_ERROR_NONE Successful |
[in] | latitude | The updated latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The updated longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The updated altitude (meters) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | speed | The updated speed (km/h) |
[in] | direction | The updated direction (in degrees from the north) |
[in] | climb | The updated climb (km/h) |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data) |
Called at defined interval with updated velocity information.
[in] | speed | The updated speed (km/h) |
[in] | direction | The updated direction (in degrees from the north) |
[in] | climb | The updated climb (km/h) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data) |
Called when the user-defined zones are entered or exited.
[in] | state | The boundary state |
[in] | latitude | The updated latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The updated longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The updated altitude (meters) |
[in] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
[in] | user_data | The user data passed from the callback registration function |
Enumeration for the location service accessibility state.
Enumeration for Approximate accuracy level of given information.
enum location_error_e |
Enumeration for error code for Location manager.
enum location_method_e |
Enumeration for Location method type.
int location_manager_add_boundary | ( | location_manager_h | manager, |
const location_bounds_h | bounds | ||
) |
Adds bounds for a given location manager.
[in] | manager | The location manager handle |
[in] | bounds | The location bounds handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_OUT_OF_MEMORY | Out of memory |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_clear_mock_location | ( | location_manager_h | manager | ) |
Clears a mock location.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_SETTING_OFF | MOCK location is not enabled |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_create | ( | location_method_e | method, |
location_manager_h * | manager | ||
) |
Creates a new location manager.
[in] | method | The location method |
[out] | manager | The location manager handle that is newly created |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_OUT_OF_MEMORY | Out of memory |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_destroy | ( | location_manager_h | manager | ) |
Releases the location manager.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_enable_method | ( | const location_method_e | method, |
const bool | enable | ||
) |
Enables the given location method.
[in] | method | The location method to be checked |
[in] | enable | The value to set |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | Permission denied |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_enable_mock_location | ( | const bool | enable | ) |
Enables mock location.
The mock location is a testing function to make location API and callback deliver a mock location set by location_manager_set_mock_location() instead of real positioning data even in the other applications.
[in] | enable | The value to set |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_SETTING_OFF | MOCK location is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | Permission denied |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_foreach_boundary | ( | location_manager_h | manager, |
location_bounds_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all location bounds by invoking a specific callback for each location bounds.
[in] | manager | The location manager handle |
[in] | callback | The iteration callback |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_foreach_location_batch | ( | location_manager_h | manager, |
location_batch_get_location_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all location information by invoking a specific callback for each location data.
[in] | manager | The location manager handle |
[in] | callback | The iteration callback function |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
Gets the current application's location accessibility status.
[out] | state | The current location service accessibility status |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_accuracy | ( | location_manager_h | manager, |
location_accuracy_level_e * | level, | ||
double * | horizontal, | ||
double * | vertical | ||
) |
Gets the current accuracy information.
[in] | manager | The location manager handle |
[out] | level | The accuracy level |
[out] | horizontal | The horizontal accuracy (meters) |
[out] | vertical | The vertical accuracy (meters) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_distance | ( | double | start_latitude, |
double | start_longitude, | ||
double | end_latitude, | ||
double | end_longitude, | ||
double * | distance | ||
) |
Gets the distance in meters between two locations.
[in] | start_latitude | The starting latitude [-90.0 ~ 90.0] (degrees) |
[in] | start_longitude | The starting longitude [-180.0 ~ 180.0] (degrees) |
[in] | end_latitude | The ending latitude [-90.0 ~ 90.0] (degrees) |
[in] | end_longitude | The ending longitude [-180.0 ~ 180.0] (degrees) |
[out] | distance | The distance between two locations (meters) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_last_accuracy | ( | location_manager_h | manager, |
location_accuracy_level_e * | level, | ||
double * | horizontal, | ||
double * | vertical | ||
) |
Gets the last accuracy information which is recorded.
[in] | manager | The location manager handle |
[out] | level | The last accuracy level |
[out] | horizontal | The last horizontal accuracy (meters) |
[out] | vertical | The last vertical accuracy (meters) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_last_location | ( | location_manager_h | manager, |
double * | altitude, | ||
double * | latitude, | ||
double * | longitude, | ||
double * | climb, | ||
double * | direction, | ||
double * | speed, | ||
location_accuracy_level_e * | level, | ||
double * | horizontal, | ||
double * | vertical, | ||
time_t * | timestamp | ||
) |
Gets the last location information.
The altitude, latitude, longitude, climb, direction, speed, and timestamp
values should be 0, if there is no record of any previous position information.
[in] | manager | The location manager handle |
[out] | altitude | The current altitude (meters) |
[out] | latitude | The current latitude [-90.0 ~ 90.0] (degrees) |
[out] | longitude | The current longitude [-180.0 ~ 180.0] (degrees) |
[out] | climb | The climb (km/h) |
[out] | direction | The direction, degrees from the north |
[out] | speed | The speed (km/h) |
[out] | level | The accuracy level |
[out] | horizontal | The horizontal accuracy (meters) |
[out] | vertical | The vertical accuracy (meters) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_last_position | ( | location_manager_h | manager, |
double * | altitude, | ||
double * | latitude, | ||
double * | longitude, | ||
time_t * | timestamp | ||
) |
Gets the last position information which is recorded.
The altitude, latitude, longitude, and timestamp
values should be 0, if there is no record of any previous position information.
[in] | manager | The location manager handle |
[out] | altitude | The last altitude (meters) |
[out] | latitude | The last latitude [-90.0 ~ 90.0] (degrees) |
[out] | longitude | The last longitude [-180.0 ~ 180.0] (degrees) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_last_velocity | ( | location_manager_h | manager, |
double * | climb, | ||
double * | direction, | ||
double * | speed, | ||
time_t * | timestamp | ||
) |
Gets the last velocity information which is recorded.
The climb, direction, and speed values should be 0
, if there is no record of any previous velocity information.
[in] | manager | The location manager handle |
[out] | climb | The last climb (km/h) |
[out] | direction | The last direction, degrees from the north |
[out] | speed | The last speed (km/h) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_location | ( | location_manager_h | manager, |
double * | altitude, | ||
double * | latitude, | ||
double * | longitude, | ||
double * | climb, | ||
double * | direction, | ||
double * | speed, | ||
location_accuracy_level_e * | level, | ||
double * | horizontal, | ||
double * | vertical, | ||
time_t * | timestamp | ||
) |
Gets the current position information.
The result contains the current altitude, latitude, longitude, climb, direction, speed, level, horizontal, and vertical with a measurement timestamp.
[in] | manager | The location manager handle |
[out] | altitude | The current altitude (meters) |
[out] | latitude | The current latitude [-90.0 ~ 90.0] (degrees) |
[out] | longitude | The current longitude [-180.0 ~ 180.0] (degrees) |
[out] | climb | The climb (km/h) |
[out] | direction | The direction, degrees from the north |
[out] | speed | The speed (km/h) |
[out] | level | The accuracy level |
[out] | horizontal | The horizontal accuracy (meters) |
[out] | vertical | The vertical accuracy (meters) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_method | ( | location_manager_h | manager, |
location_method_e * | method | ||
) |
Gets the given location manager's method.
[in] | manager | The location manager handle |
[out] | method | The location method |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_position | ( | location_manager_h | manager, |
double * | altitude, | ||
double * | latitude, | ||
double * | longitude, | ||
time_t * | timestamp | ||
) |
Gets the current position information.
The result contains the current altitude, latitude, and longitude with a measurement timestamp.
[in] | manager | The location manager handle |
[out] | altitude | The current altitude (meters) |
[out] | latitude | The current latitude [-90.0 ~ 90.0] (degrees) |
[out] | longitude | The current longitude [-180.0 ~ 180.0] (degrees) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_get_velocity | ( | location_manager_h | manager, |
double * | climb, | ||
double * | direction, | ||
double * | speed, | ||
time_t * | timestamp | ||
) |
Gets the current velocity information.
The result contains the current climb, direction, and speed with a measurement timestamp.
[in] | manager | The location manager handle |
[out] | climb | The climb (km/h) |
[out] | direction | The direction, degrees from the north |
[out] | speed | The speed (km/h) |
[out] | timestamp | The timestamp (time when measurement took place or 0 if valid) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_is_enabled_method | ( | location_method_e | method, |
bool * | enable | ||
) |
Checks whether the given location method is enabled or not on setting.
[in] | method | The location method to be checked |
[out] | enable | The result value of checking the given location method |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_is_enabled_mock_location | ( | bool * | enabled | ) |
Checks whether the mock location is enabled.
[out] | enabled | Indicates whether the mock location is enabled |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
bool location_manager_is_supported_method | ( | location_method_e | method | ) |
Checks whether the given location method is available.
[in] | method | The location method to be checked |
true
if the specified location method is supported, otherwise false
if it is not available LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
int location_manager_remove_boundary | ( | location_manager_h | manager, |
const location_bounds_h | bounds | ||
) |
Deletes bounds for a given location manager.
[in] | manager | The location manager handle |
[in] | bounds | The location bounds handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_OUT_OF_MEMORY | Out of memory |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_request_single_location | ( | location_manager_h | manager, |
int | timeout, | ||
location_updated_cb | callback, | ||
void * | user_data | ||
) |
Requests to update current location once.
[in] | manager | The location manager handle |
[in] | timeout | Timeout to stop requesting single location after |
[in] | callback | The location callback function to register |
[in] | user_data | The user data to be passed to the callback function |
LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NETWORK_FAILED | Network failed |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_distance_based_location_changed_cb | ( | location_manager_h | manager, |
location_changed_cb | callback, | ||
int | interval, | ||
double | distance, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked at minimum interval or minimum distance with updated position information.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | interval | The minimum interval between position updates [1 ~ 120] (seconds) |
[in] | distance | The minimum distance between position updates [1 ~ 120] (meters) |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_fused_mode | ( | location_manager_h | manager, |
location_fused_mode_e | mode | ||
) |
Changes behavior of the location source selection in the fused location method.
[in] | manager | The location manager handle |
[in] | mode | The fused mode. |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | The service is not available |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_location_batch_cb | ( | location_manager_h | manager, |
location_batch_cb | callback, | ||
int | batch_interval, | ||
int | batch_period, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when batch_period is expired.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | batch_interval | The batch sampling interval [1 ~ 255] (seconds) |
[in] | batch_period | The batch period [1 ~ 60000] (seconds) |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_location_changed_cb | ( | location_manager_h | manager, |
location_changed_cb | callback, | ||
int | interval, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked at defined interval with updated location information.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | interval | The interval [1 ~ 120] (seconds) |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_mock_location | ( | location_manager_h | manager, |
const double | latitude, | ||
const double | longitude, | ||
const double | altitude, | ||
const double | speed, | ||
const double | direction, | ||
const double | accuracy | ||
) |
Sets a mock location for the given location method.
The location sets the given altitude, latitude, longitude, climb, direction, speed, level, horizontal, and vertical accuracy.
[in] | manager | The location manager handle |
[in] | latitude | The current latitude [-90.0 ~ 90.0] (degrees) |
[in] | longitude | The current longitude [-180.0 ~ 180.0] (degrees) |
[in] | altitude | The current altitude (meters) |
[in] | speed | The speed (km/h) |
[in] | direction | The direction, degrees from the north [0.0 ~ 360.0] |
[in] | accuracy | The horizontal accuracy (meters) |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid argument |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_SETTING_OFF | MOCK location is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_position_updated_cb | ( | location_manager_h | manager, |
location_position_updated_cb | callback, | ||
int | interval, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked at defined interval with updated position information.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | interval | The interval [1 ~ 120] (seconds) |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_service_state_changed_cb | ( | location_manager_h | manager, |
location_service_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the location service state is changed.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_setting_changed_cb | ( | location_method_e | method, |
location_setting_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the location setting is changed.
[in] | method | The method to observe |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_velocity_updated_cb | ( | location_manager_h | manager, |
location_velocity_updated_cb | callback, | ||
int | interval, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked at defined interval with updated velocity information.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | interval | The interval [1 ~ 120] (seconds) |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_set_zone_changed_cb | ( | location_manager_h | manager, |
location_zone_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the previously set boundary area is entered or left.
[in] | manager | The location manager handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_start | ( | location_manager_h | manager | ) |
Starts the location service.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NETWORK_FAILED | Network failed |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_start_batch | ( | location_manager_h | manager | ) |
Starts the location batch service.
Calling this function starts location batch service, location_batch_cb() will be invoked every batch_period seconds. After that, you can obtain all locations with location_manager_foreach_location_batch().
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NETWORK_FAILED | Network failed |
LOCATIONS_ERROR_GPS_SETTING_OFF | GPS is not enabled |
LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED | The application does not have the privilege to call this method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_stop | ( | location_manager_h | manager | ) |
Stops the location service.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NETWORK_FAILED | Network failed |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_stop_batch | ( | location_manager_h | manager | ) |
Stops the location batch service.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE | Service not available |
LOCATIONS_ERROR_NETWORK_FAILED | Network failed |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_location_batch_cb | ( | location_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_location_changed_cb | ( | location_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_position_updated_cb | ( | location_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_setting_changed_cb | ( | location_method_e | method | ) |
Unregisters the callback function.
[in] | method | The method to observe |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_INCORRECT_METHOD | Incorrect method |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_velocity_updated_cb | ( | location_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |
int location_manager_unset_zone_changed_cb | ( | location_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The location manager handle |
0
on success, otherwise a negative error value LOCATIONS_ERROR_NONE | Successful |
LOCATIONS_ERROR_INVALID_PARAMETER | Invalid parameter |
LOCATIONS_ERROR_NOT_SUPPORTED | Not supported |