中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何跳转到指定电话号码发送短信的页面?
微信扫码分享
import { common, Want } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; interface ModelContactInfo { contactsName: string; telephone: string; } @Entry @Component struct Index { build() { Column() { Button("跳转").onClick(() => { const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; let contactInfo: Array<ModelContactInfo> = [{ contactsName: 'ZhangSan', telephone: '16888888888' }]; let want: Want = { bundleName: 'com.ohos.mms', abilityName: 'com.ohos.mms.MainAbility', parameters: { contactObjects: JSON.stringify(contactInfo), pageFlag: 'conversation' } }; context.startAbility(want).then(() => { console.info('Start MMSAbility successfully.'); }).catch((err: BusinessError) => { console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); }) } .height("100%") .width('100%') .justifyContent(FlexAlign.Center) } }