Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2c30e95b
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看板
提交
2c30e95b
编写于
2月 23, 2023
作者:
G
Gloria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs against 13992+14771+14303+14276+14205
Signed-off-by: wusongqing<wusongqing@huawei.com>
上级
459882dd
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
184 addition
and
180 deletion
+184
-180
en/application-dev/reference/apis/js-apis-ability-featureAbility.md
...tion-dev/reference/apis/js-apis-ability-featureAbility.md
+113
-108
en/application-dev/reference/apis/js-apis-ability-particleAbility.md
...ion-dev/reference/apis/js-apis-ability-particleAbility.md
+71
-72
未找到文件。
en/application-dev/reference/apis/js-apis-ability-featureAbility.md
浏览文件 @
2c30e95b
此差异已折叠。
点击以展开。
en/application-dev/reference/apis/js-apis-ability-particleAbility.md
浏览文件 @
2c30e95b
...
...
@@ -14,7 +14,7 @@ The ParticleAbility module is used to perform operations on abilities of the Dat
## Modules to Import
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
```
## particleAbility.startAbility
...
...
@@ -40,27 +40,27 @@ Observe the following when using this API:
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
wantConstant
from
'
@ohos.ability.wantConstant
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
import
wantConstant
from
'
@ohos.ability.wantConstant
'
;
particleAbility
.
startAbility
(
{
want
:
{
action
:
"
action.system.home
"
,
entities
:
[
"
entity.system.home
"
],
type
:
"
MIMETYPE
"
,
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
type
:
'
MIMETYPE
'
,
flags
:
wantConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
deviceId
:
""
,
bundleName
:
"
com.example.Data
"
,
abilityName
:
"
EntryAbility
"
,
uri
:
""
deviceId
:
''
,
bundleName
:
'
com.example.Data
'
,
abilityName
:
'
EntryAbility
'
,
uri
:
''
},
},
(
error
,
result
)
=>
{
console
.
log
(
'
particleAbility startAbility errCode:
'
+
error
+
'
result:
'
+
result
)
console
.
error
(
'
particleAbility startAbility errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}
'
);
},
)
)
;
```
## particleAbility.startAbility
...
...
@@ -91,25 +91,25 @@ Observe the following when using this API:
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
wantConstant
from
'
@ohos.ability.wantConstant
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
import
wantConstant
from
'
@ohos.ability.wantConstant
'
;
particleAbility
.
startAbility
(
{
want
:
{
action
:
"
action.system.home
"
,
entities
:
[
"
entity.system.home
"
],
type
:
"
MIMETYPE
"
,
action
:
'
action.system.home
'
,
entities
:
[
'
entity.system.home
'
],
type
:
'
MIMETYPE
'
,
flags
:
wantConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
deviceId
:
""
,
bundleName
:
"
com.example.Data
"
,
abilityName
:
"
EntryAbility
"
,
uri
:
""
deviceId
:
''
,
bundleName
:
'
com.example.Data
'
,
abilityName
:
'
EntryAbility
'
,
uri
:
''
},
},
).
then
((
data
)
=>
{
console
.
info
(
"
particleAbility startAbility
"
);
console
.
info
(
'
particleAbility startAbility
'
);
});
```
...
...
@@ -130,13 +130,13 @@ Terminates this ParticleAbility. This API uses an asynchronous callback to retur
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
particleAbility
.
terminateSelf
(
(
error
,
result
)
=>
{
console
.
log
(
'
particleAbility terminateSelf errCode:
'
+
error
+
'
result:
'
+
result
)
console
.
log
(
'
particleAbility terminateSelf errCode:
${JSON.stringify(error)}, result: ${JSON.stringify(result)}
'
);
}
)
)
;
```
## particleAbility.terminateSelf
...
...
@@ -156,10 +156,10 @@ Terminates this ParticleAbility. This API uses a promise to return the result.
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
info
(
"
particleAbility terminateSelf
"
);
console
.
info
(
'
particleAbility terminateSelf
'
);
});
```
...
...
@@ -194,10 +194,10 @@ Observe the following when using this API:
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
var
uri
=
""
;
particleAbility
.
acquireDataAbilityHelper
(
uri
)
let
uri
=
''
;
particleAbility
.
acquireDataAbilityHelper
(
uri
)
;
```
...
...
@@ -228,17 +228,17 @@ import wantAgent from '@ohos.app.ability.wantAgent';
function
callback
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
"
Operation failed cause:
"
+
JSON
.
stringify
(
err
)
);
console
.
error
(
'
Operation failed cause: ${JSON.stringify(err)}
'
);
}
else
{
console
.
info
(
"
Operation succeeded
"
);
console
.
info
(
'
Operation succeeded
'
);
}
}
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
}
],
operationType
:
wantAgent
.
OperationType
.
START_ABILITY
,
...
...
@@ -248,8 +248,8 @@ let wantAgentInfo = {
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
wantAgentObj
)
=>
{
let
basicContent
=
{
title
:
"
title
"
,
text
:
"
text
"
title
:
'
title
'
,
text
:
'
text
'
};
let
notificationContent
=
{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -298,8 +298,8 @@ import wantAgent from '@ohos.app.ability.wantAgent';
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
}
],
operationType
:
wantAgent
.
OperationType
.
START_ABILITY
,
...
...
@@ -309,8 +309,8 @@ let wantAgentInfo = {
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
wantAgentObj
)
=>
{
let
basicContent
=
{
title
:
"
title
"
,
text
:
"
text
"
title
:
'
title
'
,
text
:
'
text
'
};
let
notificationContent
=
{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -322,9 +322,9 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
};
let
id
=
1
;
particleAbility
.
startBackgroundRunning
(
id
,
request
).
then
(()
=>
{
console
.
info
(
"
Operation succeeded
"
);
console
.
info
(
'
Operation succeeded
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
Operation failed cause:
"
+
JSON
.
stringify
(
err
)
);
console
.
error
(
'
Operation failed cause: ${JSON.stringify(err)}
'
);
});
});
...
...
@@ -351,9 +351,9 @@ import particleAbility from '@ohos.ability.particleAbility';
function
callback
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
"
Operation failed cause:
"
+
JSON
.
stringify
(
err
)
);
console
.
error
(
'
Operation failed cause: ${JSON.stringify(err)}
'
);
}
else
{
console
.
info
(
"
Operation succeeded
"
);
console
.
info
(
'
Operation succeeded
'
);
}
}
...
...
@@ -381,9 +381,9 @@ Requests to cancel a continuous task from the system. This API uses a promise to
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
particleAbility
.
cancelBackgroundRunning
().
then
(()
=>
{
console
.
info
(
"
Operation succeeded
"
);
console
.
info
(
'
Operation succeeded
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
Operation failed cause:
"
+
JSON
.
stringify
(
err
)
);
console
.
error
(
'
Operation failed cause: ${JSON.stringify(err)}
'
);
});
```
...
...
@@ -413,25 +413,25 @@ Observe the following when using this API:
**Example**
```
ts
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
rpc
from
'
@ohos.rpc
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
import
rpc
from
'
@ohos.rpc
'
;
function
onConnectCallback
(
element
,
remote
)
{
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
)
);
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
${(remote instanceof rpc.RemoteProxy)}
'
);
}
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
'
+
element
.
deviceId
)
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
${element.deviceId}
'
);
}
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
'
+
code
)
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
${code}
'
);
}
var
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
{
bundleName
:
"
com.ix.ServiceAbility
"
,
abilityName
:
"
ServiceAbilityA
"
,
bundleName
:
'
com.ix.ServiceAbility
'
,
abilityName
:
'
ServiceAbilityA
'
,
},
{
onConnect
:
onConnectCallback
,
...
...
@@ -441,9 +441,9 @@ var connId = particleAbility.connectAbility(
);
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
console
.
log
(
"
data:
"
+
data
);
console
.
log
(
'
data: ${data}
'
);
}).
catch
((
error
)
=>
{
console
.
log
(
'
particleAbilityTest result errCode :
'
+
error
.
code
)
console
.
log
(
'
particleAbilityTest result errCode :
${error.code}
'
);
});
```
...
...
@@ -468,21 +468,21 @@ import particleAbility from '@ohos.ability.particleAbility';
import
rpc
from
'
@ohos.rpc
'
;
function
onConnectCallback
(
element
,
remote
)
{
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
)
);
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
${(remote instanceof rpc.RemoteProxy)}
'
);
}
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
'
+
element
.
deviceId
)
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
${element.deviceId}
'
);
}
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
'
+
code
)
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
${code}
'
);
}
var
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
{
bundleName
:
"
com.ix.ServiceAbility
"
,
abilityName
:
"
ServiceAbilityA
"
,
bundleName
:
'
com.ix.ServiceAbility
'
,
abilityName
:
'
ServiceAbilityA
'
,
},
{
onConnect
:
onConnectCallback
,
...
...
@@ -492,8 +492,7 @@ var connId = particleAbility.connectAbility(
);
particleAbility
.
disconnectAbility
(
connId
,
(
err
)
=>
{
console
.
log
(
"
particleAbilityTest disconnectAbility err====>
"
+
(
"
json err=
"
)
+
JSON
.
stringify
(
err
));
console
.
log
(
'
particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}
'
);
});
```
...
...
@@ -519,21 +518,21 @@ import particleAbility from '@ohos.ability.particleAbility';
import
rpc
from
'
@ohos.rpc
'
;
function
onConnectCallback
(
element
,
remote
)
{
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
)
);
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
${(remote instanceof rpc.RemoteProxy)}
'
);
}
function
onDisconnectCallback
(
element
)
{
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
'
+
element
.
deviceId
)
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
${element.deviceId}
'
);
}
function
onFailedCallback
(
code
)
{
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
'
+
code
)
console
.
log
(
'
particleAbilityTest ConnectAbility onFailed errCode :
${code}
'
);
}
var
connId
=
particleAbility
.
connectAbility
(
let
connId
=
particleAbility
.
connectAbility
(
{
bundleName
:
"
com.ix.ServiceAbility
"
,
abilityName
:
"
ServiceAbilityA
"
,
bundleName
:
'
com.ix.ServiceAbility
'
,
abilityName
:
'
ServiceAbilityA
'
,
},
{
onConnect
:
onConnectCallback
,
...
...
@@ -543,9 +542,9 @@ var connId = particleAbility.connectAbility(
);
particleAbility
.
disconnectAbility
(
connId
).
then
((
data
)
=>
{
console
.
log
(
"
data:
"
+
data
);
console
.
log
(
'
data: ${data}
'
);
}).
catch
((
error
)
=>
{
console
.
log
(
'
particleAbilityTest result errCode :
'
+
error
.
code
)
console
.
log
(
'
particleAbilityTest result errCode :
${error.code}
'
);
});
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录