• Home
Name Date Size #Lines LOC

..--

figures/12-May-2024-

frameworks/12-May-2024-10,9069,516

interfaces/inner_api/include/12-May-2024-4,2092,980

sa_profile/12-May-2024-8783

services/12-May-2024-12,53910,261

test/12-May-2024-20,39315,565

.gitignoreD12-May-202417 21

CODEOWNERSD12-May-2024795 1716

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-20242.5 KiB5233

README.en.mdD12-May-20244.7 KiB8044

README.mdD12-May-20243.7 KiB8647

bundle.jsonD12-May-20244.3 KiB118117

config.gniD12-May-20242.7 KiB7163

README.en.md

1# Location<a name="EN-US_TOPIC_0000001080646118"></a>
2
3-   [Introduction](#section11660541593)
4-   [Directory Structure](#section161941989596)
5-   [Constraints](#section119744591305)
6-   [Usage](#section1312121216216)
7    -   [Available APIs](#section1551164914237)
8    -   [Usage Guidelines](#section129654513264)
9
10-   [Repositories Involved](#section1371113476307)
11
12## Introduction<a name="section11660541593"></a>
13
14People take their mobile devices wherever they go. Mobile devices have become a necessity in people's daily routines, whether it be for looking at the weather forecast, browsing news, hailing a taxi, navigating, or recording data from a workout. All these activities are so much associated with the location services on mobile devices.
15
16With the location awareness capability offered by OpenHarmony, mobile devices will be able to obtain real-time, accurate location data. Building location awareness into your application can also lead to a better contextual experience for application users.
17
18Your application can call location-specific APIs to obtain the location information of a mobile device for offering location-based services such as drive navigation and motion track recording.
19
20**Basic Concepts**
21
22Location awareness helps determine where a mobile device locates. The system identifies the location of a mobile device with its coordinates, and uses location technologies such as Global Navigation Satellite System \(GNSS\) and network positioning \(for example, base station positioning or WLAN/Bluetooth positioning\) to provide diverse location-based services. These advanced location technologies make it possible to obtain the accurate location of the mobile device, regardless of whether it is indoors or outdoors.
23
24-   **Coordinate**
25
26    A coordinate describes a location on the earth using the longitude and latitude in reference to the World Geodetic Coordinate System 1984.
27
28-   **GNSS positioning**
29
30    GNSS positioning locates a mobile device by using the location algorithm offered by the device chip to compute the location information provided by the Global Navigation Satellite System, for example, GPS, GLONASS, BeiDou, and Galileo. Whichever positioning system will be used during the location process depends on a hardware capability of the device.
31
32-   **Base station positioning**
33
34    Base station positioning estimates the current location of a mobile device based on the location of the resident base station in reference to the neighboring base stations. This technology provides only a low accuracy and requires access to the cellular network.
35
36-   **WLAN or Bluetooth positioning**
37
38    WLAN or Bluetooth positioning estimates the current location of a mobile device based on the locations of WLANs and Bluetooth devices that can be discovered by the device. The location accuracy of this technology depends on the distribution of fixed WLAN access points \(APs\) and Bluetooth devices around the device. A high density of WLAN APs and Bluetooth devices can produce a more accurate location result than base station positioning. This technology also requires access to the network.
39
40
41**Figure  1**  Location subsystem architecture<a name="fig4460722185514"></a>
42
43![](figures/En-1.png)
44
45
46## Directory Structure<a name="section161941989596"></a>
47
48```
49/base/location      # Source code directory structure:
50  ├── figures       # Store the architecture diagram in readme
51  ├── frameworks    # Location framework code
52  ├── interfaces    # External interface
53  ├── sa_profile    # SA's profile
54  ├── services      # Directory of SA codes for location services
55  ├── test          # Test Code Directory
56```
57
58## Constraints<a name="section119744591305"></a>
59
60 - Your application can use the location function only after the user has granted the permission and turned on the function. If the location function is off, the system will not provide the location service for any application.
61
62 - Since the location information is considered sensitive, your application still needs to obtain the location access permission from the user even if the user has turned on the location function. The system will provide the location service for your application only after it has been granted the permission to access the device location information.
63
64## Usage<a name="section1312121216216"></a>
65
66### Available APIs<a name="section1551164914237"></a>
67
68https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.geolocation.d.ts
69
70
71### Usage Guidelines<a name="section129654513264"></a>
72
73https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-geolocation.md
74
75
76## Repositories Involved<a name="section1371113476307"></a>
77
78base_location
79
80

README.md

1# 位置服务组件<a name="ZH-CN_TOPIC_0000001115112235"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section161941989596)
5-   [约束](#section119744591305)
6-   [说明](#section1312121216216)
7    -   [接口说明](#section1551164914237)
8    -   [使用说明](#section129654513264)
9
10-   [相关仓](#section1371113476307)
11
12## 简介<a name="section11660541593"></a>
13
14移动终端设备已经深入人们日常生活的方方面面,如查看所在城市的天气、新闻轶事、出行打车、旅行导航、运动记录。这些习以为常的活动,都离不开定位用户终端设备的位置。
15
16当用户处于这些丰富的使用场景中时,系统的位置定位能力可以提供实时准确的位置数据。对于开发者,设计基于位置体验的服务,也可以更好的满足用户的需求。
17
18当应用在实现基于设备位置的功能时,如:驾车导航,记录运动轨迹等,可以调用该模块的API接口,完成位置信息的获取
19
20基本概念
21
22位置能力用于确定用户设备在哪里,系统使用位置坐标标示用户设备的位置,并使用多种定位技术提供位置服务,如GNSS定位、基站定位、WLAN/蓝牙定位(基站定位、WLAN/蓝牙定位后续统称“网络定位技术”)。通过这些定位技术,无论用户设备在室内或是户外,都可以准确地确定用户设备的位置。
23
24-   **坐标**
25
26    系统以1984年世界大地坐标系统为参考,使用经度、纬度数据描述地球上的一个位置。
27
28-   **GNSS定位**
29
30    基于全球导航卫星系统,包含:GPS、GLONASS、北斗、Galileo等,通过导航卫星,设备芯片提供的定位算法,来确定设备准确位置。定位过程具体使用哪些定位系统,取决于用户设备的硬件能力。
31
32-   **基站定位**
33
34    根据设备当前驻网基站和相邻基站的位置,估算设备当前位置。此定位方式的定位结果精度相对较低,并且需要设备可以访问蜂窝网络。
35
36-   **WLAN、蓝牙定位**
37
38    根据设备可搜索到的周围WLAN、蓝牙设备位置,估算设备当前位置。此定位方式的定位结果精度依赖设备周围可见的固定WLAN、蓝牙设备的分布,密度较高时,精度也相较与基站定位方式更高,同时也需要设备可以访问网络。
39
40
41**图 1** **子系统架构图**<a name="fig4460722185514"></a>
42
43![](figures/zh-1.png)
44
45
46## 目录<a name="section161941989596"></a>
47
48```
49/base/location      # 源代码目录结构:
50  ├── figures       # 存放readme中的架构图
51  ├── frameworks    # 框架代码
52  ├── interfaces    # 对外接口
53  ├── sa_profile    # SA的配置文件
54  ├── services      # 定位服务各个SA代码目录
55  ├── test          # 测试代码目录
56```
57
58## 约束<a name="section119744591305"></a>
59
60 - 使用设备的位置能力,需要用户进行确认并主动开启位置开关。如果位置开关没有开启,系统不会向任何应用提供位置服务。
61
62 - 设备位置信息属于用户敏感数据,所以即使用户已经开启位置开关,应用在获取设备位置前仍需向用户申请位置访问权限。在用户确认允许后,系统才会向应用提供位置服务。
63
64## 说明<a name="section1312121216216"></a>
65
66### 接口说明<a name="section1551164914237"></a>
67
68见如下文档:
69https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.geolocation.d.ts
70
71
72
73### 使用说明<a name="section129654513264"></a>
74
75见如下文档:
76https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-geolocation.md
77
78
79
80
81## 相关仓<a name="section1371113476307"></a>
82
83位置服务子系统
84
85base_location
86