未验证 提交 1304bcd6 编写于 作者: Q ql 提交者: Gitee

添加启动远端service

Signed-off-by: Nql <qianli16@huawei.com>
上级 0a242ef9
......@@ -94,6 +94,21 @@ let promise = featureAbility.startAbility(
- 如果Service尚未运行,则系统会先调用onStart()来初始化Service,再回调Service的onCommand()方法来启动Service。
- 如果Service正在运行,则系统会直接回调Service的onCommand()方法来启动Service。
启动远端设备Service的代码示例如下(getRemoteDeviceId()方法详见连接远程Service):
```javascript
import featureAbility from '@ohos.ability.featureAbility';
let promise = featureAbility.startAbility(
{
want:
{
deviceId: getRemoteDeviceId(), //远端设备Id
bundleName: "com.jstest.service",
abilityName: "com.jstest.service.ServiceAbility",
},
}
);
```
### 停止Service
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册