提交 b861b626 编写于 作者: Z zengyawen

add arkui

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 5f0f62aa
无相关合并请求

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
# 应用开发
- [应用开发导读](application-dev-guide.md)
- DevEco Studio(OpenHarmony)使用指南
- [概述](quick-start/deveco-studio-overview.md)
- [版本变更说明](quick-start/deveco-studio-release-notes.md)
- [配置OpenHarmony SDK](quick-start/configuring-openharmony-sdk.md)
- 创建OpenHarmony工程
- [使用工程向导创建新工程](quick-start/use-wizard-to-create-project.md)
- [通过导入Sample方式创建新工程](quick-start/import-sample-to-create-project.md)
- [配置OpenHarmony应用签名信息](quick-start/configuring-openharmony-app-signature.md)
- [安装运行OpenHarmony应用](quick-start/installing-openharmony-app.md)
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- [包结构说明](quick-start/package-structure.md)
- 快速入门
- [开发准备](quick-start/start-overview.md)
- [使用JS语言开发](quick-start/start-with-js.md)
- JS UI框架
- [JS UI框架概述](ui/ui-js-overview.md)
- 构建用户界面
- [组件介绍](ui/ui-js-building-ui-component.md)
- 构建布局
- [布局说明](ui/ui-js-building-ui-layout-intro.md)
- [添加标题行和文本区域](ui/ui-js-building-ui-layout-text.md)
- [添加图片区域](ui/ui-js-building-ui-layout-image.md)
- [添加留言区域](ui/ui-js-building-ui-layout-comment.md)
- [添加容器](ui/ui-js-building-ui-layout-external-container.md)
- [添加交互](ui/ui-js-building-ui-interactions.md)
- [动画](ui/ui-js-building-ui-animation.md)
- [事件](ui/ui-js-building-ui-event.md)
- [页面路由](ui/ui-js-building-ui-routes.md)
- [自定义组件](ui/ui-js-custom-components.md)
- 音频
- [音频开发概述](media/audio-overview.md)
- [音频播放开发指导](media/audio-playback.md)
- [音频管理开发指导](media/audio-management.md)
- [音频录制开发指导](media/audio-recorder.md)
- IPC与RPC通信
- [IPC与RPC通信概述](connectivity/ipc-rpc-overview.md)
- [IPC与RPC通信开发指导](connectivity/ipc-rpc-development-guideline.md)
- [远端状态订阅开发实例](connectivity/subscribe-remote-state.md)
- JS 开发参考
- 框架说明
- [文件组织](js-reference/js-framework-file.md)
- [js标签配置](js-reference/js-framework-js-tag.md)
- [app.js](js-reference/js-framework-js-file.md)
- 语法
- [HML语法参考](js-reference/js-framework-syntax-hml.md)
- [CSS语法参考](js-reference/js-framework-syntax-css.md)
- [JS语法参考](js-reference/js-framework-syntax-js.md)
- [生命周期](js-reference/js-framework-lifecycle.md)
- [资源限定与访问](js-reference/js-framework-resource-restriction.md)
- [多语言支持](js-reference/js-framework-multiple-languages.md)
- 组件
- 通用
- [通用属性](js-reference/component/js-components-common-attributes.md)
- [通用样式](js-reference/component/js-components-common-styles.md)
- [通用事件](js-reference/component/js-components-common-events.md)
- [通用方法](js-reference/component/js-components-common-methods.md)
- [动画样式](js-reference/component/js-components-common-animation.md)
- [渐变样式](js-reference/component/js-components-common-gradient.md)
- [转场样式](js-reference/component/js-components-common-transition.md)
- [媒体查询](js-reference/component/js-components-common-mediaquery.md)
- [自定义字体样式](js-reference/component/js-components-common-customizing-font.md)
- [原子布局](js-reference/component/js-components-common-atomic-layout.md)
- 容器组件
- [badge](js-reference/component/js-components-container-badge.md)
- [dialog](js-reference/component/js-components-container-dialog.md)
- [div](js-reference/component/js-components-container-div.md)
- [form](js-reference/component/js-components-container-form.md)
- [list](js-reference/component/js-components-container-list.md)
- [list-item](js-reference/component/js-components-container-list-item.md)
- [list-item-group](js-reference/component/js-components-container-list-item-group.md)
- [panel](js-reference/component/js-components-container-panel.md)
- [popup](js-reference/component/js-components-container-popup.md)
- [refresh](js-reference/component/js-components-container-refresh.md)
- [stack](js-reference/component/js-components-container-stack.md)
- [stepper](js-reference/component/js-components-container-stepper.md)
- [stepper-item](js-reference/component/js-components-container-stepper-item.md)
- [swiper](js-reference/component/js-components-container-swiper.md)
- [tabs](js-reference/component/js-components-container-tabs.md)
- [tab-bar](js-reference/component/js-components-container-tab-bar.md)
- [tab-content](js-reference/component/js-components-container-tab-content.md)
- 基础组件
- [button](js-reference/component/js-components-basic-button.md)
- [chart](js-reference/component/js-components-basic-chart.md)
- [divider](js-reference/component/js-components-basic-divider.md)
- [image](js-reference/component/js-components-basic-image.md)
- [image-animator](js-reference/component/js-components-basic-image-animator.md)
- [input](js-reference/component/js-components-basic-input.md)
- [label](js-reference/component/js-components-basic-label.md)
- [marquee](js-reference/component/js-components-basic-marquee.md)
- [menu](js-reference/component/js-components-basic-menu.md)
- [option](js-reference/component/js-components-basic-option.md)
- [picker](js-reference/component/js-components-basic-picker.md)
- [picker-view](js-reference/component/js-components-basic-picker-view.md)
- [piece](js-reference/component/js-components-basic-piece.md)
- [progress](js-reference/component/js-components-basic-progress.md)
- [qrcode](js-reference/component/js-components-basic-qrcode.md)
- [rating](js-reference/component/js-components-basic-rating.md)
- [richtext](js-reference/component/js-components-basic-richtext.md)
- [search](js-reference/component/js-components-basic-search.md)
- [select](js-reference/component/js-components-basic-select.md)
- [slider](js-reference/component/js-components-basic-slider.md)
- [span](js-reference/component/js-components-basic-span.md)
- [switch](js-reference/component/js-components-basic-switch.md)
- [text](js-reference/component/js-components-basic-text.md)
- [textarea](js-reference/component/js-components-basic-textarea.md)
- [toolbar](js-reference/component/js-components-basic-toolbar.md)
- [toolbar-item](js-reference/component/js-components-basic-toolbar-item.md)
- [toggle](js-reference/component/js-components-basic-toggle.md)
- 媒体组件
- [video](js-reference/component/js-components-media-video.md)
- 画布组件
- [canvas组件](js-reference/component/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D对象](js-reference/component/js-components-canvas-canvasrenderingcontext2d.md)
- [Image对象](js-reference/component/js-components-canvas-image.md)
- [CanvasGradient对象](js-reference/component/js-components-canvas-canvasgradient.md)
- [ImageData对象](js-reference/component/js-components-canvas-imagedata.md)
- [Path2D对象](js-reference/component/js-components-canvas-path2d.md)
- [ImageBitmap对象](js-reference/component/js-components-canvas-imagebitmap.md)
- [OffscreenCanvas对象](js-reference/component/js-components-canvas-offscreencanvas.md)
- [OffscreenCanvasRenderingContext2D对象](js-reference/component/js-components-canvas-offscreencanvasrenderingcontext2d.md)
- 栅格组件
- [基本概念](js-reference/component/js-components-grid-basic-concepts.md)
- [grid-container](js-reference/component/js-components-grid-container.md)
- [grid-row](js-reference/component/js-components-grid-row.md)
- [grid-col](js-reference/component/js-components-grid-col.md)
- svg组件
- [通用属性](js-reference/component/js-components-svg-common-attributes.md)
- [svg](js-reference/component/js-components-svg.md)
- [rect](js-reference/component/js-components-svg-rect.md)
- [circle](js-reference/component/js-components-svg-circle.md)
- [ellipse](js-reference/component/js-components-svg-ellipse.md)
- [path](js-reference/component/js-components-svg-path.md)
- [line](js-reference/component/js-components-svg-line.md)
- [polyline](js-reference/component/js-components-svg-polyline.md)
- [polygon](js-reference/component/js-components-svg-polygon.md)
- [text](js-reference/component/js-components-svg-text.md)
- [tspan](js-reference/component/js-components-svg-tspan.md)
- [textPath](js-reference/component/js-components-svg-textpath.md)
- [animate](js-reference/component/js-components-svg-animate.md)
- [animateMotion](js-reference/component/js-components-svg-animate-motion.md)
- [animateTransform](js-reference/component/js-components-svg-animate-transform.md)
- 自定义组件
- [基本用法](js-reference/component/js-components-custom-basic-usage.md)
- [自定义事件](js-reference/component/js-components-custom-events.md)
- [Props](js-reference/component/js-components-custom-props.md)
- [事件参数](js-reference/component/js-components-custom-event-parameter.md)
- [slot插槽](js-reference/component/js-components-custom-slot.md)
- [生命周期定义](js-reference/component/js-components-custom-lifecycle.md)
- 接口
- 基本功能
- [应用上下文](js-reference/apis/js-apis-system-app.md)
- [日志打印](js-reference/apis/js-apis-basic-features-logs.md)
- [页面路由](js-reference/apis/js-apis-system-router.md)
- [弹窗](js-reference/apis/js-apis-system-prompt.md)
- [应用配置](js-reference/apis/js-apis-system-configuration.md)
- [定时器](js-reference/apis/js-apis-system-timer.md)
- [动画](js-reference/apis/js-apis-animator.md)
- [应用打点](js-reference/apis/js-apis-hiappevent.md)
- [性能打点](js-reference/apis/js-apis-bytrace.md)
- [分布式帐号管理](js-reference/apis/js-apis-distributedaccount.md)
- 媒体
- [音频管理](js-reference/apis/js-apis-audio.md)
- [音频播放](js-reference/apis/js-apis-media.md)
- 数据管理
- [文件管理](js-reference/apis/js-apis-fileio.md)
- [单版本分布式数据库](js-reference/apis/js-apis-data-singlekvstore.md)
- [创建和获取分布式数据库](js-reference/apis/js-apis-data-kvmanager.md)
- [KVManager配置信息](js-reference/apis/js-apis-data-kvmanager-config.md)
- [分布式数据库操作描述](js-reference/apis/js-apis-data-kvstore.md)
- [数据类型描述](js-reference/apis/js-apis-data-type.md)
- [轻量级存储](js-reference/apis/js-apis-data-storage.md)
- 设备管理
- [设备信息](js-reference/apis/js-apis-deviceinfo.md)
- [系统属性](js-reference/apis/js-apis-systemparameter.md)
- [系统恢复](js-reference/apis/js-apis-update.md)
- [显示设备属性](js-reference/apis/js-apis-display.md)
- [电池和充电属性](js-reference/apis/js-apis-batteryinfo.md)
- [设置系统屏幕亮度](js-reference/apis/js-apis-brightness.md)
- [系统电源管理](js-reference/apis/js-apis-power.md)
- [Runninglock锁](js-reference/apis/js-apis-runninglock.md)
- [传感器](js-reference/apis/js-apis-sensor.md)
- [振动](js-reference/apis/js-apis-vibrate.md)
- [国际化(I18n)](js-reference/apis/js-apis-i18n.md)
- [国际化(Intl)](js-reference/apis/js-apis-intl.md)
- [资源管理](js-reference/apis/js-apis-resourcemanage.md)
- [时间设置](js-reference/apis/js-apis-systemtime.md)
- [升级](js-reference/apis/js-apis-libupdateclient.md)
- [获取进程相关的信息](js-reference/apis/js-apis-process.md)
- [字符串编解码](js-reference/apis/js-apis-util.md)
- [启动一个worker](js-reference/apis/js-apis-worker.md)
- [URL字符串解析](js-reference/apis/js-apis-url.md)
- [快速入门](quick-start/start.md)
- [Ability框架](ability/Readme-CN.md)
- 方舟开发框架(ArkUI)
- [基于JS扩展的类Web开发范式](ui/ui-arkui-js.md)
- [基于TS扩展的声明式开发范式](ui/ui-arkui-ts.md)
- [音频](media/audio.md)
- [IPC与RPC通信](connectivity/ipc-rpc.md)
- [JS 开发参考](js-reference/Readme-CN.md)
# Ability框架
* [PageAbility开发说明](page-ability.md)
* [ServiceAbility开发说明](service-ability.md)
* [基于Native的Data Ability创建与访问](data-ability-creating-accessing.md)
* [CommonEvent开发指南](common-event.md)
* [Notification开发指南](notification.md)
此差异已折叠。
# 基于Native的Data Ability创建与访问
## Data Ability基本概念
通过Ability派生出的DataAbility类(以下简称“Data”),有助于应用管理其自身和其他应用存储数据的访问,并提供与其他应用共享数据的方法。Data既可用于同设备不同应用的数据共享,也支持跨设备不同应用的数据共享。
## 创建Data
### 1. Data子系统实现
1. 基于Native的Data子系统,需要继承Ability类,成为Ability的派生类来实现功能
2. 需要实现父类中Insert,Query,Update,Delete接口的业务内容.保证能够满足数据库存储业务的基本需求.BatchInsert与ExecuteBatch接口已经在系统中实现遍历逻辑,依赖Insert,Query,Update,Delete接口逻辑,来实现数据的批量处理.
3. 使用REGISTER_AA宏将Data的类名注册到系统服务中
### 2. 子系统配置
| Json重要字段 | 备注说明 |
| ------------- | ------------------------------------------------------------ |
| "name" | Ability名子,对应Ability派生的Data类名 |
| "type" | Ability类型,Data对应的Ability类型未"data" |
| "uri" | 通信使用的URI |
| "srcLanguage" | Data实现语言,c++实现的Data填写c++, js实现的Data填写js |
| "visible" | 对其他应用是否可见, 设置为true时, Data才能与其他应用进行通信传输数据 |
**config.json配置样例**
```json
"abilities":[{
"name": ".DataAbility",
"icon": "$media:snowball",
"label": "Data Firs Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "data",
"uri": "dataability://com.ix.DataAbility",
"srcLanguage": "c++",
"visible": true
}]
```
## 访问Data
### 1 JS应用开发前准备
基础依赖包:
1. @ohos.ability.featureAbility
2. @ohos.data.dataability
3. @ohos.data.rdb
与Data子系统通信的Uri字符串
### 2 JS应用开发接口
工具接口类对象创建
```js
// 作为参数传递的Uri,与config中定义的Uri的区别是多了一个"/",是因为作为参数传递的uri中,在第二个与第三个"/"中间,存在一个DeviceID的参数
var urivar = "dataability:///com.ix.DataAbility"
var DAHelper = featureAbility.acquireDataAbilityHelper(
urivar
);
```
数据库相关的rdb数据构建
```js
var valuesBucket = {"name": "gaolu"}
var da = new ohos_data_ability.DataAbilityPredicates()
var valArray =new Array("value1");
var cars = new Array({"batchInsert1" : "value1",});
```
向指定的Data子系统插入数据,inster调用
```js
// callbacke方式调用:
DAHelper.insert(
urivar,
valuesBucket,
(error, data) => {
expect(typeof(data)).assertEqual("number")
}
);
// promise方式调用:
var datainsert = await DAHelper.insert(
urivar,
valuesBucket
);
```
删除Data子系统中指定的数据, delete调用
```js
// callbacke方式调用:
DAHelper.delete(
urivar,
da,
(error, data) => {
expect(typeof(data)).assertEqual("number")
}
);
// promise方式调用:
var datadelete = await DAHelper.delete(
urivar,
da,
);
```
更新指定Data子系统中的数据, update调用
```js
// callbacke方式调用:
DAHelper.update(
urivar
valuesBucket,
da,
(error, data) => {
expect(typeof(data)).assertEqual("number")
}
);
// promise方式调用:
var dataupdate = await DAHelper.update(
urivar,
valuesBucket,
da,
);
```
在指定的Data子系统中查找数据,query调用
```js
// callbacke方式调用:
DAHelper.query(
urivar,
valArray,
da,
(error, data) => {
expect(typeof(data)).assertEqual("object")
}
);
// promise方式调用:
var dataquery = await DAHelper.query(
urivar,
valArray,
da
);
```
向指定的数据子系统批量插入数据,batchInsert调用
```js
// callbacke方式调用:
DAHelper.batchInsert(
urivar,
cars,
(error, data) => {
expect(typeof(data)).assertEqual("number")
}
);
// promise方式调用:
var databatchInsert = await DAHelper.batchInsert(
urivar,
cars
);
```
向指定的Data子系统进行数据的批量处理,executeBatch调用
```js
// callbacke方式调用:
DAHelper.executeBatch(
urivar,
[
{
uri: urivar,
type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
valuesBucket: {"executeBatch" : "value1",},
predicates: da,
expectedCount:0,
PredicatesBackReferences: {},
interrupted:true,
}
],
(error, data) => {
expect(typeof(data)).assertEqual("object")
}
);
// promise方式调用:
var dataexecuteBatch = await DAHelper.executeBatch(
urivar,
[
{
uri: urivar,
type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
valuesBucket:
{
"executeBatch" : "value1",
},
predicates: da,
expectedCount:0,
PredicatesBackReferences: {},
interrupted:true,
}
]
);
```
zh-cn/application-dev/ability/figures/page-ability-lifecycle-callbacks.png

49.1 KB

zh-cn/application-dev/ability/figures/page-ability-lifecycle.png

14.3 KB

此差异已折叠。
# PageAbility开发说明
## PageAbility介绍
Page模板(以下简称“Page”)是FA唯一支持的模板,用于提供与用户交互的能力。
## PageAbility的生命周期
**Ability生命周期介绍**(Ability Life Cycle)是Ability被调度到INACTIVE、ACTIVE、BACKGROUND等各个状态的统称(主要涉及PageAbility类型和ServiceAbility类型的Ability)。
- **PageAbility类型的Ability生命周期流转如下图所示**
![PageAbility-Lifecycle](figures/page-ability-lifecycle.png)
**Ability生命周期状态说明:**
- **UNINITIALIZED**:未初始状态,为临时状态,Ability被创建后会由UNINITIALIZED状态进入INITIAL状态。
- **INITIAL**:初始化状态,也表示停止状态,表示当前Ability未运行,Ability被启动后由INITIAL态进入INACTIVE状态。
- **INACTIVE**:未激活状态,表示当前窗口已显示但是无焦点状态,由于Window暂未支持焦点的概念,当前状态与ACTIVE一致。
- **ACTIVE**:前台激活状态,表示当前窗口已显示,并获取焦点,Ability在退到后台之前先由ACTIVE状态进入INACTIVE状态。
- **BACKGROUND**: 后台状态,表示当前Ability退到后台,Ability在被销毁后由BACKGROUND状态进入INITIAL状态,或者重新被激活后由BACKGROUND状态进入ACTIVE状态。
**PageAbility类型Ability生命周期回调如下图所示:**
![PageAbility-Lifecycel-Callbacks](figures/page-ability-lifecycle-callbacks.png)
## 启动本地PageAbility
导入模块
```
import featureAbility from '@ohos.ability.featureAbility'
```
```
FeatureAbility.startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>)
```
* 接口说明
启动新的ability(callback形式)
* 示例
```javascript
import featureAbility from '@ohos.ability.featureAbility'
featureAbility.startAbility(
{
want:
{
action: "",
entities: [""],
type: "",
options: {
// indicates the grant to perform read operations on the URI
authReadUriPermission: true,
// indicates the grant to perform write operations on the URI
authWriteUriPermission: true,
// support forward intent result to origin ability
abilityForwardResult: true,
// used for marking the ability start-up is triggered by continuation
abilityContinuation: true,
// specifies whether a component does not belong to ohos
notOhosComponent: true,
// specifies whether an ability is started
abilityFormEnabled: true,
// indicates the grant for possible persisting on the URI.
authPersistableUriPermission: true,
// indicates the grant for possible persisting on the URI.
authPrefixUriPermission: true,
// support distributed scheduling system start up multiple devices
abilitySliceMultiDevice: true,
// indicates that an ability using the service template is started regardless of whether the
// host application has been started.
startForegroundAbility: true,
// install the specified ability if it's not installed.
installOnDemand: true,
// return result to origin ability slice
abilitySliceForwardResult: true,
// install the specified ability with background mode if it's not installed.
installWithBackgroundMode: true
},
deviceId: "",
bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbility",
uri: ""
},
},
);
)
```
## 启动远程PageAbility
导入模块
```
import featureAbility from '@ohos.ability.featureAbility'
```
```
FeatureAbility.startAbility(parameter: StartAbilityParameter)
```
* 接口说明
启动远程的ability(promise形式)
前提:通过deviceManager获取远程deviceid
* 示例
```javascript
var promise = await ability.startAbility(
{
want:
{
deviceId: this.deviceId,
bundleName: "com.example.test",
abilityName: "com.example.test.MainAbility",
},
}
);
```
\ No newline at end of file
zh-cn/application-dev/ability/public_sys-resources/icon-caution.gif

580 字节

zh-cn/application-dev/ability/public_sys-resources/icon-danger.gif

580 字节

zh-cn/application-dev/ability/public_sys-resources/icon-note.gif

394 字节

zh-cn/application-dev/ability/public_sys-resources/icon-notice.gif

406 字节

zh-cn/application-dev/ability/public_sys-resources/icon-tip.gif

253 字节

zh-cn/application-dev/ability/public_sys-resources/icon-warning.gif

580 字节

# ServiceAbility开发说明
## 创建Service<a name="section17436202895812"></a>
1. Service也是一种Ability,Ability为Service提供了以下生命周期方法,开发者可以重写这些方法,来添加其他Ability请求与Service Ability交互时的处理方法。
- onStart()
该方法在创建Service的时候调用,用于Service的初始化。在Service的整个生命周期只会调用一次,调用时传入的Want应为空。
- onCommand()
在Service创建完成之后调用,该方法在客户端每次启动该Service时都会调用,开发者可以在该方法中做一些调用统计、初始化类的操作。
- onConnect()
在Ability和Service连接时调用,该方法返回IRemoteObject对象,开发者可以在该回调函数中生成对应Service的IPC通信通道,以便Ability与Service交互。Ability可以多次连接同一个Service,系统会缓存该Service的IPC通信对象,只有第一个客户端连接Service时,系统才会调用Service的onConnect方法来生成IRemoteObject对象,而后系统会将同一个RemoteObject对象传递至其他连接同一个Service的所有客户端,而无需再次调用onConnect方法。
- onDisconnect()
在Ability与绑定的Service断开连接时调用。
- onStop()
在Service销毁时调用。Service应通过实现此方法来清理任何资源,如关闭线程、注册的侦听器等。
创建Service的代码示例如下:
```javascript
export default {
onStart(want) {
console.log('SerivceAbility onStart');
},
onCommand(want, restart, startId) {
console.log('SerivceAbility onCommand');
},
onConnect(want) {
console.log('SerivceAbility OnConnect');
},
onDisconnect() {
console.log('SerivceAbility OnDisConnect');
},
onStop() {
console.log('SerivceAbility onStop');
},
}
```
2. 注册Service。
Service也需要在应用配置文件config.json中进行注册,注册类型type需要设置为service。
```javascript
{
"module": {
"abilities": [
{
"name": ".ServiceAbility",
"type": "service",
"visible": true
...
}
]
...
}
...
}
```
## 启动Service<a name="section944219415599"></a>
Ability为开发者提供了startAbility()方法来启动另外一个Ability。因为Service也是Ability的一种,开发者同样可以通过将Want传递给该方法来启动Service。
开发者可以通过构造包含BundleName与AbilityName的Want对象来设置目标Service信息。参数的含义如下:
- BundleName:表示包名称。
- AbilityName:表示待启动的Ability名称。
启动本地设备Service的代码示例如下:
```javascript
import featureAbility from '@ohos.ability.featureability';
var promise = await featureAbility.startAbility(
{
want:
{
bundleName: "com.jstest.serviceability",
abilityName: "com.jstest.serviceability.MainAbility",
},
}
);
```
- 执行上述代码后,Ability将通过startAbility() 方法来启动Service。
- 如果Service尚未运行,则系统会先调用onStart()来初始化Service,再回调Service的onCommand()方法来启动Service。
- 如果Service正在运行,则系统会直接回调Service的onCommand()方法来启动Service。
- 停止Service
Service一旦创建就会一直保持在后台运行,除非必须回收内存资源,否则系统不会停止或销毁Service。开发者可以在Service中通过terminateAbility()停止本Service或在其他Ability调用stopAbility()来停止Service。
## 连接Service<a name="section126857614018"></a>
如果Service需要与Page Ability或其他应用的Service Ability进行交互,则须创建用于连接的Connection。Service支持其他Ability通过connectAbility()方法与其进行连接。
在使用connectAbility()处理回调时,需要传入目标Service的Want与IAbilityConnection的实例。IAbilityConnection提供了以下方法供开发者实现:onConnect()是用来处理连接Service成功的回调,onDisconnect()是用来处理Service异常死亡的回调,onFailed()是用来处理连接Service失败的回调。
创建连接Service回调实例的代码示例如下:
```javascript
var mRemote;
function onConnectCallback(element, remote){
console.log('ConnectAbility onConnect Callback')
mRemote = remote;
}
function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect Callback')
}
function onFailedCallback(code){
console.log('ConnectAbility onFailed Callback')
}
```
连接Service的代码示例如下:
```javascript
import featureAbility from '@ohos.ability.featureability';
var connId = featureAbility.connectAbility(
{
bundleName: "com.jstest.serviceability",
abilityName: "com.jstest.serviceability.MainAbility",
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
```
同时,Service侧也需要在onConnect()时返回IRemoteObject,从而定义与Service进行通信的接口。onConnect()需要返回一个IRemoteObject对象,HarmonyOS提供了IRemoteObject的默认实现,用户可以通过继承rpc.RemoteObject来创建自定义的实现类。
Service侧把自身的实例返回给调用侧的代码示例如下:
```javascript
import rpc from "@ohos.rpc";
var mMyStub;
export default {
onStart(want) {
class MyStub extends rpc.RemoteObject{
constructor(des) {
if (typeof des === 'string') {
super(des, des.length);
}
return null;
}
onRemoteRequest(code, message, reply, option) {
}
}
mMyStub = new MyStub("ServiceAbility-test");
},
onCommand(want, restart, startId) {
console.log('SerivceAbility onCommand');
},
onConnect(want) {
console.log('SerivceAbility OnConnect');
return mMyStub;
},
onDisconnect() {
console.log('SerivceAbility OnDisConnect');
},
onStop() {
console.log('SerivceAbility onStop');
},
}
```
# 接口<a name="ZH-CN_TOPIC_0000001164290698"></a>
- Ability框架
- [FeatureAbility模块](js-apis-featureAbility.md)
- [ParticleAbility模块](js-apis-particleAbility.md)
- [DataAbilityHelper模块](js-apis-dataAbilityHelper.md)
- [DataUriUtils模块](js-apis-DataUriUtils.md)
- [Bundle模块](js-apis-Bundle.md)
- [CommonEvent模块](js-apis-commonEvent.md)
- [Notification模块](js-apis-notification.md)
- [Context模块](js-apis-Context.md)
- [基本功能](js-apis-basic-features.md)
- [应用上下文](js-apis-system-app.md)
- [日志打印](js-apis-basic-features-logs.md)
- [页面路由](js-apis-system-router.md)
- [弹窗](js-apis-system-prompt.md)
- [应用配置](js-apis-system-configuration.md)
- [定时器](js-apis-system-timer.md)
- [动画](js-apis-animator.md)
- [应用打点](js-apis-hiappevent.md)
- [性能打点](js-apis-bytrace.md)
- [分布式帐号管理](js-apis-distributedaccount.md)
- [媒体](js-apis-multmedia.md)
- [音频管理](js-apis-audio.md)
- [音频播放](js-apis-media.md)
- 网络与连接
- [拨打电话](js-apis-call.md)
- [短信服务](js-apis-sms.md)
- [SIM卡管理](js-apis-sim.md)
- [网络搜索](js-apis-radio.md)
- [数据管理](js-apis-data.md)
- [文件管理](js-apis-fileio.md)
- [单版本分布式数据库](js-apis-data-singlekvstore.md)
- [创建和获取分布式数据库](js-apis-data-kvmanager.md)
- [KVManager配置信息](js-apis-data-kvmanager-config.md)
- [分布式数据库操作描述](js-apis-data-kvstore.md)
- [数据类型描述](js-apis-data-type.md)
- [轻量级存储](js-apis-data-storage.md)
- [设备管理](js-apis-device-mgmt.md)
- [设备信息](js-apis-deviceinfo.md)
- [系统属性](js-apis-systemparameter.md)
- [系统恢复](js-apis-update.md)
- [显示设备属性](js-apis-display.md)
- [电池和充电属性](js-apis-batteryinfo.md)
- [设置系统屏幕亮度](js-apis-brightness.md)
- [系统电源管理](js-apis-power.md)
- [Runninglock锁](js-apis-runninglock.md)
- [传感器](js-apis-sensor.md)
- [振动](js-apis-vibrate.md)
- [国际化(I18n)](js-apis-i18n.md)
- [国际化(Intl)](js-apis-intl.md)
- [资源管理](js-apis-resourcemanage.md)
- [时间设置](js-apis-systemtime.md)
- [升级](js-apis-libupdateclient.md)
- [获取进程相关的信息](js-apis-process.md)
- [字符串编解码](js-apis-util.md)
- [启动一个worker](js-apis-worker.md)
- [URL字符串解析](js-apis-url.md)
### Bundle模块(JS端SDK接口)
# Bundle模块(JS端SDK接口)
#### 支持设备
......
### Context模块(JS端SDK接口)
# Context模块(JS端SDK接口)
#### 支持设备
......
# Ability框架<a name="ZH-CN_TOPIC_0000001176585610"></a>
- [FeatureAbility模块](js-apis-featureAbility.md)
- [ParticleAbility模块](js-apis-particleAbility.md)
- [DataAbilityHelper模块](js-apis-dataAbilityHelper.md)
- [DataUriUtils模块](js-apis-DataUriUtils.md)
- [Bundle模块](js-apis-Bundle.md)
- [CommonEvent模块](js-apis-commonEvent.md)
- [Notification模块](js-apis-notification.md)
- [Context模块](js-apis-Context.md)
\ No newline at end of file
# 账号管理<a name="ZH-CN_TOPIC_0000001221945315"></a>
- **[分布式帐号管理](js-apis-distributed-account.md)**
# 音频管理<a name="ZH-CN_TOPIC_0000001149807881"></a>
- [导入模块](#s56d19203690d4782bfc74069abb6bd71)
- [权限](#section11257113618419)
- [getAudioManager\(\): AudioManager](#section84581011418)
- [AudioVolumeType](#section92261857172218)
- [DeviceFlag](#section11285183164210)
- [DeviceRole](#section380038142619)
- [DeviceType](#devicetype)
- [ActiveDeviceType7+](#activedevicetype)
- [AudioRingMode7+](#section14948916131018)
- [AudioManager](#section8265143814015)
- [setVolume\(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void\>\): void](#section189141826104616)
- [setVolume\(volumeType: AudioVolumeType, volume: number\): Promise<void\>](#section102021249114612)
- [getVolume\(volumeType: AudioVolumeType, callback: AsyncCallback<number\>\): void](#section4387320194714)
- [getVolume\(volumeType: AudioVolumeType\): Promise<number\>](#section04121965119)
- [getMinVolume\(volumeType: AudioVolumeType, callback: AsyncCallback<number\>\): void](#section188714283511)
- [getMinVolume\(volumeType: AudioVolumeType\): Promise<number\>](#section41556389511)
- [getMaxVolume\(volumeType: AudioVolumeType, callback: AsyncCallback<number\>\): void](#section690395418516)
- [getMaxVolume\(volumeType: AudioVolumeType\): Promise<number\>](#section155151345217)
- [mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void\>\): void7+](#section13516136134613)
- [mute\(volumeType: AudioVolumeType, mute: boolean\): Promise<void\>7+](#section7519036144616)
- [isMute\(volumeType: AudioVolumeType, callback: AsyncCallback<boolean\>\): void7+](#section10684183819585)
- [isMute\(volumeType: AudioVolumeType\): Promise<boolean\>7+](#section6920211145610)
- [isActive\(volumeType: AudioVolumeType, callback: AsyncCallback<boolean\>\): void7+](#section380012544121)
- [isActive\(volumeType: AudioVolumeType\): Promise<boolean\>7+](#section1880315481216)
- [setRingerMode\(mode: AudioRingMode, callback: AsyncCallback<void\>\): void7+](#section18572131483613)
- [setRingerMode\(mode: AudioRingMode\): Promise<void\>7+](#section55741914143615)
- [getRingerMode\(callback: AsyncCallback<AudioRingMode\>\): void7+](#section149044108162)
- [getRingerMode\(\): Promise<AudioRingMode\>7+](#section13908210101620)
- [setAudioParameter\(key: string, value: string, callback: AsyncCallback<void\>\): void7+](#section1691957174818)
- [setAudioParameter\(key: string, value: string\): Promise<void\>7+](#section18121057174820)
- [getAudioParameter\(key: string, callback: AsyncCallback<string\>\): void7+](#section1415145714812)
- [getAudioParameter\(key: string\): Promise<string\>7+](#section3185577485)
- [getDevices\(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors\>\): void](#section11536182020523)
- [getDevices\(deviceFlag: DeviceFlag\): Promise<AudioDeviceDescriptors\>](#section181733125210)
- [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void\>\): void7+](#section103558400222)
- [setDeviceActive\(deviceType: ActiveDeviceType, active: boolean\): Promise<void\>7+](#section1235914401228)
- [isDeviceActive\(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean\>\): void7+](#section12363240122219)
- [isDeviceActive\(deviceType: ActiveDeviceType\): Promise<boolean\>7+](#section18366184012213)
- [setMicrophoneMute\(mute: boolean, callback: AsyncCallback<void\>\): void7+](#section14703163618122)
- [setMicrophoneMute\(mute: boolean\): Promise<void\>7+](#section56287111791)
- [isMicrophoneMute\(callback: AsyncCallback<boolean\>\): void7+](#section6632141119912)
- [isMicrophoneMute\(\): Promise<boolean\>7+](#section196363111918)
- [AudioDeviceDescriptor](#section164657411927)
- [属性](#section4947115405)
- [AudioDeviceDescriptors](#section5181155710523)
## 导入模块<a name="s56d19203690d4782bfc74069abb6bd71"></a>
```
......
# 语言基础类库<a name="ZH-CN_TOPIC_0000001219001649"></a>
- **[获取进程相关的信息](js-apis-process.md)**
- **[URL字符串解析](js-apis-url.md)**
- **[字符串编解码](js-apis-util.md)**
- **[启动一个worker](js-apis-worker.md)**
# 应用上下文<a name="ZH-CN_TOPIC_0000001173324607"></a>
## 导入模块<a name="s1959b1529f574b74861e62008289bb21"></a>
```
import app from '@system.app';
```
## 权限列表<a name="section11257113618419"></a>
## app.getInfo<a name="s0e8ff40704e442bc87a848afa47bdfbb"></a>
getInfo\(\): <[AppResponse](#t3e93239d9b134b80957bcdd4acb05291)\>
获取当前应用配置文件中声明的信息。
- 返回值
**表 1** AppResponse
<a name="t3e93239d9b134b80957bcdd4acb05291"></a>
<table><tbody><tr id="recc81d9f995d44aa87ba9d714b756569"><td class="cellrowborder" valign="top" width="19%"><p id="aa3137ce511d140fba6cc93513a7a91e3"><a name="aa3137ce511d140fba6cc93513a7a91e3"></a><a name="aa3137ce511d140fba6cc93513a7a91e3"></a>参数名</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a6b166163db284e5ca8dc0190b36ae40a"><a name="a6b166163db284e5ca8dc0190b36ae40a"></a><a name="a6b166163db284e5ca8dc0190b36ae40a"></a>类型</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a4ba8ead9ee7b48298d9a6ed10659f13b"><a name="a4ba8ead9ee7b48298d9a6ed10659f13b"></a><a name="a4ba8ead9ee7b48298d9a6ed10659f13b"></a>说明</p>
</td>
</tr>
<tr id="row2557173813243"><td class="cellrowborder" valign="top" width="19%"><p id="p898462584011"><a name="p898462584011"></a><a name="p898462584011"></a>appID<sup id="sup193948321350"><a name="sup193948321350"></a><a name="sup193948321350"></a>6+</sup></p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="p698492564013"><a name="p698492564013"></a><a name="p698492564013"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="p1998432514020"><a name="p1998432514020"></a><a name="p1998432514020"></a>表示应用的包名,用于标识应用的唯一性。</p>
</td>
</tr>
<tr id="r64430cb15b54497f88ea6330b9a7454c"><td class="cellrowborder" valign="top" width="19%"><p id="a7cccea39636b47cd83188d400eed51e3"><a name="a7cccea39636b47cd83188d400eed51e3"></a><a name="a7cccea39636b47cd83188d400eed51e3"></a>appName</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a2f72300143c441ef9a3fb5dc2f8e4aac"><a name="a2f72300143c441ef9a3fb5dc2f8e4aac"></a><a name="a2f72300143c441ef9a3fb5dc2f8e4aac"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a1c9b8d1829ef489e9e0fd1863190d228"><a name="a1c9b8d1829ef489e9e0fd1863190d228"></a><a name="a1c9b8d1829ef489e9e0fd1863190d228"></a>表示应用的名称。</p>
</td>
</tr>
<tr id="r4f8f612a65b24ae9b75ae53893aeb3b9"><td class="cellrowborder" valign="top" width="19%"><p id="ae036f88e139e4379abdaf4969f0720ea"><a name="ae036f88e139e4379abdaf4969f0720ea"></a><a name="ae036f88e139e4379abdaf4969f0720ea"></a>versionName</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a1d379931a20144f0b6d98f5396202cd9"><a name="a1d379931a20144f0b6d98f5396202cd9"></a><a name="a1d379931a20144f0b6d98f5396202cd9"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a70c91c442f7c41439a90ceb9041252e8"><a name="a70c91c442f7c41439a90ceb9041252e8"></a><a name="a70c91c442f7c41439a90ceb9041252e8"></a>表示应用的版本名称。</p>
</td>
</tr>
<tr id="r89cf0afd5f444bd1b66ace0c31a25cda"><td class="cellrowborder" valign="top" width="19%"><p id="a3a86c086e40e475b8fb26cf43fe9a8d6"><a name="a3a86c086e40e475b8fb26cf43fe9a8d6"></a><a name="a3a86c086e40e475b8fb26cf43fe9a8d6"></a>versionCode</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="abcfd352ff3d84552938de0e2daf0703e"><a name="abcfd352ff3d84552938de0e2daf0703e"></a><a name="abcfd352ff3d84552938de0e2daf0703e"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="af943e2ec7622407387d25d9331a01245"><a name="af943e2ec7622407387d25d9331a01245"></a><a name="af943e2ec7622407387d25d9331a01245"></a>表示应用的版本号。</p>
</td>
</tr>
</tbody>
</table>
- 示例
```
var info = app.getInfo();
console.log(JSON.stringify(info));
```
## app.terminate<a name="section974325124119"></a>
terminate\(\): void
退出当前Ability
- 示例
```
app.terminate();
```
# 应用配置<a name="ZH-CN_TOPIC_0000001173324675"></a>
## 导入模块<a name="section15536249155915"></a>
```
import configuration from '@system.configuration';
```
## 权限列表<a name="section8152081004"></a>
## configuration.getLocale<a name="section8389829903"></a>
getLocale\(\): <[LocaleResponse](#table1544853546)\>
获取应用当前的语言和地区。默认与系统的语言和地区同步。
- 返回值
**表 1** LocaleResponse
<a name="table1544853546"></a>
<table><thead align="left"><tr id="row1670755549"><th class="cellrowborder" valign="top" width="17.77177717771777%" id="mcps1.2.4.1.1"><p id="p57013505413"><a name="p57013505413"></a><a name="p57013505413"></a>参数名</p>
</th>
<th class="cellrowborder" valign="top" width="12.5012501250125%" id="mcps1.2.4.1.2"><p id="p9706511540"><a name="p9706511540"></a><a name="p9706511540"></a>类型</p>
</th>
<th class="cellrowborder" valign="top" width="69.72697269726973%" id="mcps1.2.4.1.3"><p id="p16701957548"><a name="p16701957548"></a><a name="p16701957548"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="row15709513545"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p1370154548"><a name="p1370154548"></a><a name="p1370154548"></a>language</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p19701653545"><a name="p19701653545"></a><a name="p19701653545"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p37010510548"><a name="p37010510548"></a><a name="p37010510548"></a>语言。例如:zh。</p>
</td>
</tr>
<tr id="row970165135413"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p97055105414"><a name="p97055105414"></a><a name="p97055105414"></a>countryOrRegion</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1770175115413"><a name="p1770175115413"></a><a name="p1770175115413"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p77015518544"><a name="p77015518544"></a><a name="p77015518544"></a>国家或地区。例如:CN。</p>
</td>
</tr>
<tr id="row6332114185611"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p53321542567"><a name="p53321542567"></a><a name="p53321542567"></a>dir</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1433216410564"><a name="p1433216410564"></a><a name="p1433216410564"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p33321417565"><a name="p33321417565"></a><a name="p33321417565"></a>文字布局方向。取值范围:</p>
<a name="ul1861816241119"></a><a name="ul1861816241119"></a><ul id="ul1861816241119"><li>ltr:从左到右;</li><li>rtl:从右到左。</li></ul>
</td>
</tr>
<tr id="row165137101137"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p1351311101333"><a name="p1351311101333"></a><a name="p1351311101333"></a>unicodeSetting<sup id="sup1646171814502"><a name="sup1646171814502"></a><a name="sup1646171814502"></a>5+</sup></p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1513121019313"><a name="p1513121019313"></a><a name="p1513121019313"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p849701364"><a name="p849701364"></a><a name="p849701364"></a>语言环境定义的Unicode语言环境键集,如果此语言环境没有特定键集,则返回空集。</p>
<p id="p16513111012314"><a name="p16513111012314"></a><a name="p16513111012314"></a>例如:{"nu":"arab"},表示当前环境下的数字采用阿拉伯语的数字。</p>
</td>
</tr>
</tbody>
</table>
- 示例
```
const localeInfo = configuration.getLocale();
console.info(localeInfo.language);
```
# 基本功能<a name="ZH-CN_TOPIC_0000001209210689"></a>
# 基本功能<a name="ZH-CN_TOPIC_0000001173342500"></a>
- **[应用上下文](js-apis-system-app.md)**
- **[应用上下文](js-apis-basic-features-app-context.md)**
- **[日志打印](js-apis-basic-features-logs.md)**
- **[页面路由](js-apis-system-router.md)**
- **[页面路由](js-apis-basic-features-routes.md)**
- **[弹窗](js-apis-system-prompt.md)**
- **[弹窗](js-apis-basic-features-pop-up.md)**
- **[应用配置](js-apis-system-configuration.md)**
- **[应用配置](js-apis-basic-features-configuration.md)**
- **[定时器](js-apis-system-timer.md)**
- **[定时器](js-apis-basic-features-timer.md)**
- **[动画](js-apis-animator.md)**
- **[设置系统时间](js-apis-system-time.md)**
- **[动画](js-apis-basic-features-animator.md)**
- **[应用打点](js-apis-hiappevent.md)**
- **[性能打点](js-apis-bytrace.md)**
- **[分布式帐号管理](js-apis-distributedaccount.md)**
# 设置系统屏幕亮度<a name="ZH-CN_TOPIC_0000001209252189"></a>
- [导入模块](#zh-cn_topic_0000001163808920_s56d19203690d4782bfc74069abb6bd71)
- [brightness.setValue](#zh-cn_topic_0000001163808920_section1853612361618)
# 屏幕亮度<a name="ZH-CN_TOPIC_0000001152548786"></a>
>![](../../public_sys-resources/icon-note.gif) **说明:**
>从 API Version 7 开始支持。
## 导入模块<a name="zh-cn_topic_0000001163808920_s56d19203690d4782bfc74069abb6bd71"></a>
## 导入模块<a name="s56d19203690d4782bfc74069abb6bd71"></a>
```
import brightness from '@ohos.brightness.d.ts'.
import brightness from '@ohos.brightness';
```
## brightness.setValue<a name="zh-cn_topic_0000001163808920_section1853612361618"></a>
## brightness.setValue<a name="section1853612361618"></a>
setValue\(value: number\)
......@@ -20,24 +17,24 @@ setValue\(value: number\)
- 参数:
<a name="zh-cn_topic_0000001163808920_table888613685714"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001163808920_row1988683685713"><th class="cellrowborder" valign="top" width="11.03%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001163808920_p1488693625712"><a name="zh-cn_topic_0000001163808920_p1488693625712"></a><a name="zh-cn_topic_0000001163808920_p1488693625712"></a>参数名</p>
<a name="table888613685714"></a>
<table><thead align="left"><tr id="row1988683685713"><th class="cellrowborder" valign="top" width="11.03%" id="mcps1.1.5.1.1"><p id="p1488693625712"><a name="p1488693625712"></a><a name="p1488693625712"></a>参数名</p>
</th>
<th class="cellrowborder" valign="top" width="11.64%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001163808920_p1886173613571"><a name="zh-cn_topic_0000001163808920_p1886173613571"></a><a name="zh-cn_topic_0000001163808920_p1886173613571"></a>类型</p>
<th class="cellrowborder" valign="top" width="11.64%" id="mcps1.1.5.1.2"><p id="p1886173613571"><a name="p1886173613571"></a><a name="p1886173613571"></a>类型</p>
</th>
<th class="cellrowborder" valign="top" width="7.1499999999999995%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001163808920_p128861336155714"><a name="zh-cn_topic_0000001163808920_p128861336155714"></a><a name="zh-cn_topic_0000001163808920_p128861336155714"></a>必填</p>
<th class="cellrowborder" valign="top" width="7.1499999999999995%" id="mcps1.1.5.1.3"><p id="p128861336155714"><a name="p128861336155714"></a><a name="p128861336155714"></a>必填</p>
</th>
<th class="cellrowborder" valign="top" width="70.17999999999999%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001163808920_p3886143617571"><a name="zh-cn_topic_0000001163808920_p3886143617571"></a><a name="zh-cn_topic_0000001163808920_p3886143617571"></a>说明</p>
<th class="cellrowborder" valign="top" width="70.17999999999999%" id="mcps1.1.5.1.4"><p id="p3886143617571"><a name="p3886143617571"></a><a name="p3886143617571"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001163808920_row9886133613577"><td class="cellrowborder" valign="top" width="11.03%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001163808920_p14886163695720"><a name="zh-cn_topic_0000001163808920_p14886163695720"></a><a name="zh-cn_topic_0000001163808920_p14886163695720"></a>value</p>
<tbody><tr id="row9886133613577"><td class="cellrowborder" valign="top" width="11.03%" headers="mcps1.1.5.1.1 "><p id="p14886163695720"><a name="p14886163695720"></a><a name="p14886163695720"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001163808920_p9886123605716"><a name="zh-cn_topic_0000001163808920_p9886123605716"></a><a name="zh-cn_topic_0000001163808920_p9886123605716"></a>number</p>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.1.5.1.2 "><p id="p9886123605716"><a name="p9886123605716"></a><a name="p9886123605716"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="7.1499999999999995%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001163808920_p988723618577"><a name="zh-cn_topic_0000001163808920_p988723618577"></a><a name="zh-cn_topic_0000001163808920_p988723618577"></a>是</p>
<td class="cellrowborder" valign="top" width="7.1499999999999995%" headers="mcps1.1.5.1.3 "><p id="p988723618577"><a name="p988723618577"></a><a name="p988723618577"></a>是</p>
</td>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001163808920_p2512184017289"><a name="zh-cn_topic_0000001163808920_p2512184017289"></a><a name="zh-cn_topic_0000001163808920_p2512184017289"></a><span>亮度的值</span>(0~255)</p>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p2512184017289"><a name="p2512184017289"></a><a name="p2512184017289"></a><span>亮度的值</span>(0~255)</p>
</td>
</tr>
</tbody>
......@@ -46,7 +43,7 @@ setValue\(value: number\)
- 示例:
```
import brightness from '@ohos.brightness.d.ts'
import brightness from '@ohos.brightness.d.ts';
brightness.setValue(128);
```
......
# 拨打电话
- [导入模块](#导入模块)
- [call.dial](#call.dial-callback1)
- [call.dial](#call.dial-callback2)
- [call.dial](#call.dial-promise)
- [call.hasCall](#call.hasCall-callback)
- [call.hasCall](#call.hasCall-promise)
- [call.getCallState](#call.getCallState-callback])
- [call.getCallState](#call.getCallState-promise)
- [call.isEmergencyPhoneNumber<sup>7+</sup>](#call.isEmergencyPhoneNumber-callback1)
- [call.isEmergencyPhoneNumber<sup>7+</sup>](#call.isEmergencyPhoneNumber-callback2)
- [call.isEmergencyPhoneNumber<sup>7+</sup>](#call.isEmergencyPhoneNumber-promise)
- [call.formatPhoneNumber<sup>7+</sup>](#call.formatPhoneNumber-callback1)
- [call.formatPhoneNumber<sup>7+</sup>](#call.formatPhoneNumber-callback2)
- [call.formatPhoneNumber<sup>7+</sup>](#call.formatPhoneNumber-promise)
- [call.formatPhoneNumberToE164<sup>7+</sup>](#call.formatPhoneNumberToE164-callback)
- [call.formatPhoneNumberToE164<sup>7+</sup>](#call.formatPhoneNumberToE164-promise)
- [DialOptions](#DialOptions)
- [CallState](#CallState)
- [EmergencyNumberOptions<sup>7+</sup>](#EmergencyNumberOptions)
- [NumberFormatOptions<sup>7+</sup>](#NumberFormatOptions)
>**说明:**
>
>- 从 API Version 6 开始支持。
......
CommonEvent模块(JS端SDK接口)
# CommonEvent模块(JS端SDK接口)
#### 支持设备
......
# 数据管理<a name="ZH-CN_TOPIC_0000001163812204"></a>
# 数据管理<a name="ZH-CN_TOPIC_0000001218703847"></a>
- **[文件管理](js-apis-fileio.md)**
- **[单版本分布式数据库](js-apis-data-singlekvstore.md)**
- **[创建和获取分布式数据库](js-apis-data-kvmanager.md)**
- **[轻量级存储](js-apis-data-storage.md)**
- **[KVManager配置信息](js-apis-data-kvmanager-config.md)**
- **[分布式数据管理](js-apis-distributed-data.md)**
- **[分布式数据库操作描述](js-apis-data-kvstore.md)**
- **[关系型数据库](js-apis-data-rdb.md)**
- **[数据类型描述](js-apis-data-type.md)**
- **[结果集](js-apis-data-resultset.md)**
- **[轻量级存储](js-apis-data-storage.md)**
- **[DataAbility 谓词](js-apis-data-ability.md)**
### FeatureAbility模块(JS端SDK接口)
# FeatureAbility模块(JS端SDK接口)
#### 支持设备
......
# 媒体<a name="ZH-CN_TOPIC_0000001209412115"></a>
# 媒体<a name="ZH-CN_TOPIC_0000001218662311"></a>
- **[音频管理](js-apis-audio.md)**
- **[音频播放](js-apis-media.md)**
- **[音频录制](js-apis-recorder.md)**
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部