中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
应用拉起系统短信应用,并自动填充接收方号码和短信内容
微信扫码分享
Button(“跳转到短信”).onClick((event: ClickEvent) => { let context = getContext(this) as common.UIAbilityContext; class info{ contactName:string telephone: string // content:String constructor() { this.contactName = ‘ZhangSan’ this.telephone = ‘123’ } } // class want let contactInfo:Array<Object> = new Array() contactInfo[0] = new info(); let want:Want = { bundleName: ‘com.ohos.mms’, abilityName: ‘com.ohos.mms.MainAbility’, parameters: { contactObjects: JSON.stringify(contactInfo), content:“内容”, pageFlag: ‘conversation’ } }; context.startAbility(want) .then(() => { //… }) .catch((err:BusinessError) => { console.error(Failed to startAbility. Code: ${err.code}, message: ${err.message}); }); }).margin(10)