#鸿蒙学习大百科#如何跳转到指定电话号码发送短信的页面?

如何跳转到指定电话号码发送短信的页面?

HarmonyOS
2024-10-26 11:22:13
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
天涯独一隅
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)
  }
}
分享
微博
QQ
微信
回复
2024-10-26 17:25:09
相关问题
如何跳转到系统发送短信页面
2091浏览 • 1回复 待解决
如何获取电话号码归属地
384浏览 • 1回复 待解决
HarmonyOS如何跳转到短信页面
513浏览 • 1回复 待解决
如何电话号码进行格式化
488浏览 • 1回复 待解决