import
{ insightIntent }
from
'@kit.IntentsKit'
;
import
{ BusinessError }
from
'@kit.BasicServicesKit'
;
let playMusicIntent: insightIntent.InsightIntent
=
{
intentName:
"PlayMusic"
,
intentVersion:
"1.0"
,
identifier:
"52dac3b0-6520-4974-81e5-25f0879449b5"
,
intentActionInfo: {
actionMode:
"EXECUTED"
,
executedTimeSlots: {
executedStartTime:
1637393212000
,
executedEndTime:
1637393112000
,
},
currentPercentage:
50
,
},
intentEntityInfo: {
entityName:
"Music"
,
entityId:
"C10194368"
,
entityGroupId:
"C10194321312"
,
displayName:
"测试歌曲1"
,
description:
"NA"
,
logoURL:
"https://www-file.abc.com/-/media/corporate/images/home/logo/abc_logo.png"
,
keywords: [
"华为音乐"
,
"化妆"
],
rankingHint:
99
,
expirationTime:
1637393212000
,
metadataModificationTime:
1637393212000
,
activityType: [
"1"
,
"2"
,
"3"
],
artist: [
"测试歌手1"
,
"测试歌手2"
],
lyricist: [
"测试词作者1"
,
"测试词作者2"
],
composer: [
"测试曲作者1"
,
"测试曲作者2"
],
albumName:
"测试专辑"
,
duration:
244000
,
playCount:
100000
,
musicalGenre: [
"流行"
,
"华语"
,
"金曲"
,
"00后"
],
isPublicData: false,
}
}
/
/
共享数据接口 意图数组可以是更多的实体
/
/
根据实际代码上下文自行传入合适的context
insightIntent.shareIntent(context, [playMusicIntent]).then(()
=
> {
console.info(
'shareIntent succeed'
);
}).catch((err: BusinessError)
=
> {
console.error(`error.code: ${err?.code}, failed because ${err?.message}`);
});