Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
96894d41
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
96894d41
编写于
3月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2843 2494 处理完成:修改格式错误问题
Merge pull request !2843 from ester.zhou/TR-2494
上级
4dee4587
274c8283
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
49 deletion
+47
-49
en/application-dev/device/device-location-info.md
en/application-dev/device/device-location-info.md
+47
-49
未找到文件。
en/application-dev/device/device-location-info.md
浏览文件 @
96894d41
...
...
@@ -14,42 +14,42 @@ The following table describes APIs available for obtaining device location infor
**Table1**
APIs for obtaining device location information
| API | Description |
| API | Description |
| -------- | -------- |
| on(type:
'locationChange',
request:
LocationRequest,
callback:
Callback
<
Location
>
)
:
void | Registers
a
listener
for
location
changes
with
a
location
request
initiated. |
| off(type:
'locationChange',
callback?:
Callback
<
Location
>
)
:
void | Unregisters
the
listener
for
location
changes
with
the
corresponding
location
request
deleted. |
| on(type:
'locationServiceState',
callback:
Callback
<
boolean
>
)
:
void | Registers
a
listener
for
location
service
status
change
events. |
| off(type:
'locationServiceState',
callback:
Callback
<
boolean
>
)
:
void | Unregisters
the
listener
for
location
service
status
change
events. |
| on(type:
'cachedGnssLocationsReporting',
request:
CachedGnssLoactionsRequest,
callback:
Callback
<
Array
<
Location
>>
)
:
void; | Registers
a
listener
for
cached
GNSS
location
reports. |
| off(type:
'cachedGnssLocationsReporting',
callback?:
Callback
<
Array
<
Location
>>
)
:
void; | Unregisters
the
listener
for
cached
GNSS
location
reports. |
| on(type:
'gnssStatusChange',
callback:
Callback
<
SatelliteStatusInfo
>
)
:
void; | Registers
a
listener
for
satellite
status
change
events. |
| off(type:
'gnssStatusChange',
callback?:
Callback
<
SatelliteStatusInfo
>
)
:
void; | Unregisters
the
listener
for
satellite
status
change
events. |
| on(type:
'nmeaMessageChange',
callback:
Callback
<
string
>
)
:
void; | Registers
a
listener
for
GNSS
NMEA
message
change
events. |
| off(type:
'nmeaMessageChange',
callback?:
Callback
<
string
>
)
:
void; | Unregisters
the
listener
for
GNSS
NMEA
message
change
events. |
| on(type:
'fenceStatusChange',
request:
GeofenceRequest,
want:
WantAgent)
:
void; | Registers
a
listener
for
status
change
events
of
the
specified
geofence. |
| off(type:
'fenceStatusChange',
request:
GeofenceRequest,
want:
WantAgent)
:
void; | Unregisters
the
listener
for
status
change
events
of
the
specified
geofence. |
| getCurrentLocation(request:
CurrentLocationRequest,
callback:
AsyncCallback
<
Location
>
)
:
void | Obtains
the
current
location.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getCurrentLocation(request?:
CurrentLocationRequest)
:
Promise
<
Location
>
| Obtains
the
current
location.
This
function
uses
a
promise
to
return
the
result. |
| getLastLocation(callback:
AsyncCallback
<
Location
>
)
:
void | Obtains
the
previous
location.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getLastLocation()
:
Promise
<
Location
>
| Obtains
the
previous
location.
This
function
uses
a
promise
to
return
the
result. |
| isLocationEnabled(callback:
AsyncCallback
<
boolean
>
)
:
void | Checks
whether
the
location
service
is
enabled.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| isLocationEnabled()
:
Promise
<
boolean
>
| Checks
whether
the
location
service
is
enabled.
This
function
uses
a
promise
to
return
the
result. |
| requestEnableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Requests
to
enable
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| requestEnableLocation()
:
Promise
<
boolean
>
| Requests
to
enable
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| enableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Enables
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| enableLocation()
:
Promise
<
boolean
>
| Enables
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| disableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Disables
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| disableLocation()
:
Promise
<
boolean
>
| Disables
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| getCachedGnssLocationsSize(callback:
AsyncCallback
<
number
>
)
:
void; | Obtains
the
number
of
cached
GNSS
locations.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getCachedGnssLocationsSize()
:
Promise
<
number
>
; | Obtains
the
number
of
cached
GNSS
locations.
This
function
uses
a
promise
to
return
the
result. |
| flushCachedGnssLocations(callback:
AsyncCallback
<
boolean
>
)
:
void; | Obtains
all
cached
GNSS
locations
and
clears
the
GNSS
cache
queue.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| flushCachedGnssLocations()
:
Promise
<
boolean
>
; | Obtains
all
cached
GNSS
locations
and
clears
the
GNSS
cache
queue.
This
function
uses
a
promise
to
return
the
result. |
| sendCommand(command:
LocationCommand,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Sends
extended
commands
to
the
location
subsystem.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| sendCommand(command:
LocationCommand)
:
Promise
<
boolean
>
; | Sends
extended
commands
to
the
location
subsystem.
This
function
uses
a
promise
to
return
the
result. |
| isLocationPrivacyConfirmed(type
:
LocationPrivacyType,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Checks
whether
a
user
agrees
with
the
privacy
statement
of
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| isLocationPrivacyConfirmed(type
:
LocationPrivacyType,)
:
Promise
<
boolean
>
; | Checks
whether
a
user
agrees
with
the
privacy
statement
of
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| setLocationPrivacyConfirmStatus(type
:
LocationPrivacyType,
isConfirmed
:
boolean,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Sets
the
user
confirmation
status
for
the
privacy
statement
of
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| setLocationPrivacyConfirmStatus(type
:
LocationPrivacyType,
isConfirmed
:
boolean)
:
Promise
<
boolean
>
; | Sets
the
user
confirmation
status
for
the
privacy
statement
of
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| on(type:
'locationChange',
request:
LocationRequest,
callback:
Callback
<
Location
>
)
:
void | Registers
a
listener
for
location
changes
with
a
location
request
initiated. |
| off(type:
'locationChange',
callback?:
Callback
<
Location
>
)
:
void | Unregisters
the
listener
for
location
changes
with
the
corresponding
location
request
deleted. |
| on(type:
'locationServiceState',
callback:
Callback
<
boolean
>
)
:
void | Registers
a
listener
for
location
service
status
change
events. |
| off(type:
'locationServiceState',
callback:
Callback
<
boolean
>
)
:
void | Unregisters
the
listener
for
location
service
status
change
events. |
| on(type:
'cachedGnssLocationsReporting',
request:
CachedGnssLoactionsRequest,
callback:
Callback
<
Array
<
Location
>>
)
:
void; | Registers
a
listener
for
cached
GNSS
location
reports. |
| off(type:
'cachedGnssLocationsReporting',
callback?:
Callback
<
Array
<
Location
>>
)
:
void; | Unregisters
the
listener
for
cached
GNSS
location
reports. |
| on(type:
'gnssStatusChange',
callback:
Callback
<
SatelliteStatusInfo
>
)
:
void; | Registers
a
listener
for
satellite
status
change
events. |
| off(type:
'gnssStatusChange',
callback?:
Callback
<
SatelliteStatusInfo
>
)
:
void; | Unregisters
the
listener
for
satellite
status
change
events. |
| on(type:
'nmeaMessageChange',
callback:
Callback
<
string
>
)
:
void; | Registers
a
listener
for
GNSS
NMEA
message
change
events. |
| off(type:
'nmeaMessageChange',
callback?:
Callback
<
string
>
)
:
void; | Unregisters
the
listener
for
GNSS
NMEA
message
change
events. |
| on(type:
'fenceStatusChange',
request:
GeofenceRequest,
want:
WantAgent)
:
void; | Registers
a
listener
for
status
change
events
of
the
specified
geofence. |
| off(type:
'fenceStatusChange',
request:
GeofenceRequest,
want:
WantAgent)
:
void; | Unregisters
the
listener
for
status
change
events
of
the
specified
geofence. |
| getCurrentLocation(request:
CurrentLocationRequest,
callback:
AsyncCallback
<
Location
>
)
:
void | Obtains
the
current
location.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getCurrentLocation(request?:
CurrentLocationRequest)
:
Promise
<
Location
>
| Obtains
the
current
location.
This
function
uses
a
promise
to
return
the
result. |
| getLastLocation(callback:
AsyncCallback
<
Location
>
)
:
void | Obtains
the
previous
location.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getLastLocation()
:
Promise
<
Location
>
| Obtains
the
previous
location.
This
function
uses
a
promise
to
return
the
result. |
| isLocationEnabled(callback:
AsyncCallback
<
boolean
>
)
:
void | Checks
whether
the
location
service
is
enabled.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| isLocationEnabled()
:
Promise
<
boolean
>
| Checks
whether
the
location
service
is
enabled.
This
function
uses
a
promise
to
return
the
result. |
| requestEnableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Requests
to
enable
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| requestEnableLocation()
:
Promise
<
boolean
>
| Requests
to
enable
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| enableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Enables
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| enableLocation()
:
Promise
<
boolean
>
| Enables
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| disableLocation(callback:
AsyncCallback
<
boolean
>
)
:
void | Disables
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| disableLocation()
:
Promise
<
boolean
>
| Disables
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| getCachedGnssLocationsSize(callback:
AsyncCallback
<
number
>
)
:
void; | Obtains
the
number
of
cached
GNSS
locations.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| getCachedGnssLocationsSize()
:
Promise
<
number
>
; | Obtains
the
number
of
cached
GNSS
locations.
This
function
uses
a
promise
to
return
the
result. |
| flushCachedGnssLocations(callback:
AsyncCallback
<
boolean
>
)
:
void; | Obtains
all
cached
GNSS
locations
and
clears
the
GNSS
cache
queue.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| flushCachedGnssLocations()
:
Promise
<
boolean
>
; | Obtains
all
cached
GNSS
locations
and
clears
the
GNSS
cache
queue.
This
function
uses
a
promise
to
return
the
result. |
| sendCommand(command:
LocationCommand,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Sends
extended
commands
to
the
location
subsystem.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| sendCommand(command:
LocationCommand)
:
Promise
<
boolean
>
; | Sends
extended
commands
to
the
location
subsystem.
This
function
uses
a
promise
to
return
the
result. |
| isLocationPrivacyConfirmed(type
:
LocationPrivacyType,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Checks
whether
a
user
agrees
with
the
privacy
statement
of
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| isLocationPrivacyConfirmed(type
:
LocationPrivacyType,)
:
Promise
<
boolean
>
; | Checks
whether
a
user
agrees
with
the
privacy
statement
of
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
| setLocationPrivacyConfirmStatus(type
:
LocationPrivacyType,
isConfirmed
:
boolean,
callback:
AsyncCallback
<
boolean
>
)
:
void; | Sets
the
user
confirmation
status
for
the
privacy
statement
of
the
location
service.
This
function
uses
an
asynchronous
callback
to
return
the
result. |
| setLocationPrivacyConfirmStatus(type
:
LocationPrivacyType,
isConfirmed
:
boolean)
:
Promise
<
boolean
>
; | Sets
the
user
confirmation
status
for
the
privacy
statement
of
the
location
service.
This
function
uses
a
promise
to
return
the
result. |
## How to Develop
...
...
@@ -70,20 +70,18 @@ The following table describes APIs available for obtaining device location infor
```
{
"module": {
"reqPermissions": [
{
"reqPermissions": [
"name": "ohos.permission.LOCATION",
"reason": "$string:reason_description",
"usedScene": {
"ability": ["com.myapplication.LocationAbility"],
"when": "inuse"
}, {
...
}
]
}
}
```
For details about the fields, see .
2.
Import the
**geolocation**
module by which you can implement all APIs related to the basic location capabilities.
...
...
@@ -112,13 +110,13 @@ The following table describes APIs available for obtaining device location infor
**Table2**
Common use cases of the location function
| Use
Case | Constant | Description |
| Use
Case | Constant | Description |
| -------- | -------- | -------- |
| Navigation | NAVIGATION | Applicable
when
your
application
needs
to
obtain
the
real-time
location
of
a
mobile
device
outdoors,
such
as
navigation
for
driving
or
walking.
In
this
scenario,
the
GNSS
positioning
technology
is
mainly
used
to
ensure
the
location
accuracy.
However,
due
to
its
limitations,
the
technology
may
be
unable
to
provide
the
location
service
when
navigation
is
just
started
or
when
the
user
moves
into
a
shielded
environment
such
as
indoors
or
a
garage.
To
resolve
this
issue,
the
system
uses
the
network
positioning
technology
as
an
alternative
to
provide
the
location
service
for
your
application
until
the
GNSS
can
provide
stable
location
results.
This
helps
achieve
a
smooth
navigation
experience
for
users.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Trajectory
tracking | TRAJECTORY_TRACKING | Applicable
when
your
application
needs
to
record
user
trajectories,
for
example,
the
track
recording
function
of
sports
applications.
In
this
scenario,
the
GNSS
positioning
technology
is
mainly
used
to
ensure
the
location
accuracy.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Ride
hailing | CAR_HAILING | Applicable
when
your
application
needs
to
obtain
the
current
location
of
a
user
who
is
hailing
a
taxi.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Life
service | DAILY_LIFE_SERVICE | Applicable
when
your
application
only
needs
the
approximate
user
location
for
recommendations
and
push
notifications
in
scenarios
such
as
when
the
user
is
browsing
news,
shopping
online,
and
ordering
food.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Power
efficiency | NO_POWER | Applicable
when
your
application
does
not
proactively
start
the
location
service
for
a
higher
battery
efficiency.
When
responding
to
another
application
requesting
the
same
location
service,
the
system
marks
a
copy
of
the
location
result
to
your
application.
In
this
way,
your
application
will
not
consume
extra
power
for
obtaining
the
user
location.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Navigation | NAVIGATION | Applicable
when
your
application
needs
to
obtain
the
real-time
location
of
a
mobile
device
outdoors,
such
as
navigation
for
driving
or
walking.
In
this
scenario,
the
GNSS
positioning
technology
is
mainly
used
to
ensure
the
location
accuracy.
However,
due
to
its
limitations,
the
technology
may
be
unable
to
provide
the
location
service
when
navigation
is
just
started
or
when
the
user
moves
into
a
shielded
environment
such
as
indoors
or
a
garage.
To
resolve
this
issue,
the
system
uses
the
network
positioning
technology
as
an
alternative
to
provide
the
location
service
for
your
application
until
the
GNSS
can
provide
stable
location
results.
This
helps
achieve
a
smooth
navigation
experience
for
users.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Trajectory
tracking | TRAJECTORY_TRACKING | Applicable
when
your
application
needs
to
record
user
trajectories,
for
example,
the
track
recording
function
of
sports
applications.
In
this
scenario,
the
GNSS
positioning
technology
is
mainly
used
to
ensure
the
location
accuracy.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Ride
hailing | CAR_HAILING | Applicable
when
your
application
needs
to
obtain
the
current
location
of
a
user
who
is
hailing
a
taxi.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Life
service | DAILY_LIFE_SERVICE | Applicable
when
your
application
only
needs
the
approximate
user
location
for
recommendations
and
push
notifications
in
scenarios
such
as
when
the
user
is
browsing
news,
shopping
online,
and
ordering
food.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Power
efficiency | NO_POWER | Applicable
when
your
application
does
not
proactively
start
the
location
service
for
a
higher
battery
efficiency.
When
responding
to
another
application
requesting
the
same
location
service,
the
system
marks
a
copy
of
the
location
result
to
your
application.
In
this
way,
your
application
will
not
consume
extra
power
for
obtaining
the
user
location.
<br/>
By
default,
the
system
reports
location
results
at
a
minimal
interval
of
1s.
To
adopt
this
use
case,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
The following example instantiates the **RequestParam** object for navigation:
...
...
@@ -143,11 +141,11 @@ The following table describes APIs available for obtaining device location infor
**Table3**
Location priority policies
| Policy | Constant | Description |
| Policy | Constant | Description |
| -------- | -------- | -------- |
| Location
accuracy
priority | ACCURACY | This
policy
mainly
uses
the
GNSS
positioning
technology.
In
an
open
area,
the
technology
can
achieve
the
meter-level
location
accuracy,
depending
on
the
hardware
performance
of
the
device.
However,
in
a
shielded
environment,
the
location
accuracy
may
significantly
decrease.
<br/>
To
use
this
policy,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Fast
location
priority | FAST_FIRST_FIX | This
policy
uses
the
GNSS
positioning,
base
station
positioning,
WLAN
positioning,
and
Bluetooth
positioning
technologies
simultaneously
to
obtain
the
device
location
in
both
the
indoor
and
outdoor
scenarios.
When
all
positioning
technologies
provide
a
location
result,
the
system
provides
the
most
accurate
location
result
for
your
application.
This
policy
can
lead
to
significant
hardware
resource
consumption
and
power
consumption.
<br/>
To
use
this
policy,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Power
efficiency
priority | LOW_POWER | This
policy
mainly
uses
the
base
station
positioning,
WLAN
positioning,
and
Bluetooth
positioning
technologies
to
obtain
device
location
in
both
indoor
and
outdoor
scenarios.
The
location
accuracy
depends
on
the
distribution
of
surrounding
base
stations,
visible
WLANs,
and
Bluetooth
devices
and
therefore
may
fluctuate
greatly.
This
policy
is
recommended
and
can
reduce
power
consumption
when
your
application
does
not
require
high
location
accuracy
or
when
base
stations,
visible
WLANs,
and
Bluetooth
devices
are
densely
distributed.
<br/>
To
use
this
policy,
you
must
declare
at
least
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Location
accuracy
priority | ACCURACY | This
policy
mainly
uses
the
GNSS
positioning
technology.
In
an
open
area,
the
technology
can
achieve
the
meter-level
location
accuracy,
depending
on
the
hardware
performance
of
the
device.
However,
in
a
shielded
environment,
the
location
accuracy
may
significantly
decrease.
<br/>
To
use
this
policy,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Fast
location
priority | FAST_FIRST_FIX | This
policy
uses
the
GNSS
positioning,
base
station
positioning,
WLAN
positioning,
and
Bluetooth
positioning
technologies
simultaneously
to
obtain
the
device
location
in
both
the
indoor
and
outdoor
scenarios.
When
all
positioning
technologies
provide
a
location
result,
the
system
provides
the
most
accurate
location
result
for
your
application.
This
policy
can
lead
to
significant
hardware
resource
consumption
and
power
consumption.
<br/>
To
use
this
policy,
you
must
declare
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
| Power
efficiency
priority | LOW_POWER | This
policy
mainly
uses
the
base
station
positioning,
WLAN
positioning,
and
Bluetooth
positioning
technologies
to
obtain
device
location
in
both
indoor
and
outdoor
scenarios.
The
location
accuracy
depends
on
the
distribution
of
surrounding
base
stations,
visible
WLANs,
and
Bluetooth
devices
and
therefore
may
fluctuate
greatly.
This
policy
is
recommended
and
can
reduce
power
consumption
when
your
application
does
not
require
high
location
accuracy
or
when
base
stations,
visible
WLANs,
and
Bluetooth
devices
are
densely
distributed.
<br/>
To
use
this
policy,
you
must
declare
at
least
the
**ohos.permission.LOCATION**
permission
and
obtain
users'
authorization. |
The following example instantiates the **RequestParam** object for the location accuracy priority policy:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录