如何写精华回答,获更多曝光?
发布
被调用方B 应用配置如下
module.json5 配置内容如下
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
},
// out side skill
{
"actions": [
"ohos.want.action.viewData"
],
"entities": [
"entity.system.browsable"
],
"uris": [{
"scheme": "https",
"host": "www.test.com",
"port": "8080",
"pathStartWith": "query"
},
{
"scheme": "http"
}
]
}
]
调用方A (另外一个App), 配置如下
let wantInfo: Want = {
// uncomment line below if wish to implicitly query only in the specific bundle.
action: 'ohos.want.action.viewData',
// entities can be omitted.
entities: ['entity.system.browsable'],
uri: 'https://www.test.com:8080/query/student'
}
// TODO Check whether if System can resolve the want
let ctx = getContext(this) as common.UIAbilityContext
ctx.startAbility(wantInfo).then(() => {
console.log(TAG, 'start success')
}).catch((err: BusinessError) => {
console.error(TAG, 'start failed', err.code, err.message)
})
执行A 调用B, 发现 没有唤起B,而是直接走浏览器。 所以,上述的实例代码走不通。