Location
Location information has a geographical point on the Earth, and optionally location-related information can also contain information about altitude, accuracy about the geographical point and altitude, and the user speed and course of direction. Location data features include managing location information on the device.
The main location features are:
Note |
---|
To test the Tizen location-based services on the Emulator, provide location data (longitude and latitude) using the Event Injector.
However, satellite data is not supported on the Emulator, so GPS status data is available only on a target device. |
Location Manager
The Location Manager API (in mobile and wearable applications) provides the current location using the location sources specified in the location method.
With the Location Manager, you can:
- Get the current location
- Get the last known location
- Get location updates
Asynchronous location-related updates and region monitoring notifications are implemented with callback interfaces (functions whose names end with "cb").
You can use the location state and updates as follows:
If the Location Manager is working correctly, the location state is set to LOCATIONS_SERVICE_ENABLED. The device can receive notifications about location updates and accuracy changes only in this update state.
If the Location Manager is unable to run on the requested device due to weak radio reception, the location update state is set to LOCATIONS_SERVICE_DISABLED (LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE). If this situation persists for a longer period, it is recommended to stop the service and try again to conserve the device battery.
If the user revokes a permission for the application to use location information, the location update state is set to LOCATIONS_ACCESS_STATE_DENIED, and the Location Manager stops all on-going services with the application. The application can request the device user for a permission to continue the stopped service.
Location Methods
The location method is used to specify the desired quality of service of the Location Manager. For example, a location-based weather forecast application can require location-related information just to distinguish a city or a neighborhood, while a GPS navigation application can require the highest quality level to pinpoint a map location. Selecting the appropriate quality level not only helps the Location Manager to run the system efficiently, but also leads to a good user experience.
Using the location_method_e structure (in mobile and wearable applications) allows your application to specify the following methods of location positioning system:
- GPS, which uses the global positioning system
- WPS, which uses the Wi-Fi positioning system
- Hybrid, which selects the best method available at the moment
Based on the desired method, the Location Manager provides best-effort location-based services, such as an asynchronous location update or region monitoring notification.
Location Settings
Tizen provides a robust way of controlling the usage of the location data through the device location settings. The following figure shows the various options for enabling or disabling specific positioning technologies.
Figure: Location settings and indicator
The Use current location setting enables both the Global Positioning System and wireless network positioning. If one of them is enabled, the location service is enabled.
The GPS setting controls the Global Positioning System usage. It takes GPS satellite signals and provides accurate positioning services, generally outdoors. The Wireless networks setting enables the usage of network-based positioning technology, which includes Wi-Fi and cell tower-based positioning, and improves the coverage of positioning services to indoors.
All location settings are initially enabled, if the device supports GPS. To disable them, the user must manually toggle the buttons. The manual task required from the user is understood as an implicit user consent.
The location-related functions work differently based on whether the location settings are used.
Note |
---|
Either the GPS or the Wireless networks setting must be enabled to retrieve the current location of the device user. |
Once the GPS or Wireless networks setting is enabled, the user can control the usage of the location data for each application separately using the privacy setting. If the privacy setting of the application is disabled, location data is no longer available for the application.
The applications whose location setting is enabled can get the current and last known location of the user.