提交 0f972116 编写于 作者: Y yuyaozhi

Fix docs vod of ability

Signed-off-by: Nyuyaozhi <yuyaozhi@huawei.com>
上级 027e66f8
......@@ -11,7 +11,7 @@
- @ohos.data.dataAbility
- @ohos.data.rdb
- @ohos.data.relationalStore
访问DataAbility的示例代码如下:
......@@ -23,7 +23,7 @@
// 作为参数传递的URI,与config中定义的URI的区别是多了一个"/",有三个"/"
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataAbility'
import ohos_data_rdb from '@ohos.data.rdb'
import relationalStore from '@ohos.data.relationalStore'
let urivar = "dataability:///com.ix.DataAbility"
let DAHelper = featureAbility.acquireDataAbilityHelper(urivar);
......
......@@ -48,13 +48,13 @@ let context = featureAbility.getContext()
```ts
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle';
import bundleManager from '@ohos.bundle.bundleManager';
export default {
onCreate() {
// 获取context并调用相关方法
let context = featureAbility.getContext();
context.setDisplayOrientation(bundle.DisplayOrientation.LANDSCAPE).then(() => {
context.setDisplayOrientation(bundleManager.DisplayOrientation.LANDSCAPE).then(() => {
console.info("Set display orientation.")
})
console.info('Application onCreate')
......
......@@ -17,14 +17,14 @@ PageAbility创建连接本地ServiceAbility回调实例的代码以及连接本
```ts
import rpc from "@ohos.rpc"
import prompt from '@system.prompt'
import promptAction from '@ohos.promptAction'
import featureAbility from '@ohos.ability.featureAbility'
let option = {
onConnect: function onConnectCallback(element, proxy) {
console.info(`onConnectLocalService onConnectDone`)
if (proxy === null) {
prompt.showToast({
promptAction.showToast({
message: "Connect service failed"
})
return
......@@ -34,19 +34,19 @@ let option = {
let option = new rpc.MessageOption()
data.writeInterfaceToken("connect.test.token")
proxy.sendRequest(0, data, reply, option)
prompt.showToast({
promptAction.showToast({
message: "Connect service success"
})
},
onDisconnect: function onDisconnectCallback(element) {
console.info(`onConnectLocalService onDisconnectDone element:${element}`)
prompt.showToast({
promptAction.showToast({
message: "Disconnect service success"
})
},
onFailed: function onFailedCallback(code) {
console.info(`onConnectLocalService onFailed errCode:${code}`)
prompt.showToast({
promptAction.showToast({
message: "Connect local service onFailed"
})
}
......
......@@ -18,7 +18,7 @@ import ability from '@ohos.ability.ability';
使用前根据具体情况引入如下模块
```ts
import ohos_data_ability from '@ohos.data.dataAbility';
import ohos_data_rdb from '@ohos.data.rdb';
import relationalStore from '@ohos.data.relationalStore'
```
## DataAbilityHelper.openFile
......
......@@ -985,7 +985,7 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
terminateSelf(): Promise&lt;void&gt;;
停止自身。通过Promise返回结果。
停止ability自身。通过Promise返回结果。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册