HarmonyOS 拉起系统短信页面,填入相关手机号?

拉起系统短信页面,填入相关手机号、信息。使用系统短信页面发送短信

阅读 446
1 个回答

拉起短信界面并指定联系人参考demo:

import common from '@ohos.app.ability.common';
function startMMSAbilityExplicit(): void {
  let context = getContext(this) as common.UIAbilityContext;
  let contactInfo = [{
    contactsName: 'ZhangSan',
    telephone: '16888888888'
  }];
  let want = {
    bundleName: 'com.ohos.mms',
    abilityName: 'com.ohos.mms.MainAbility',
    parameters: {
      contactObjects: JSON.stringify(contactInfo),
      pageFlag: 'conversation'
    }
  };
  context.startAbility(want)
    .then(() => {
      //...
    })
    .catch((err) => {
      console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
    });
}
logo
HarmonyOS
子站问答
访问
宣传栏