tt.makePhoneCall 字节小程序调用宿主拨打电话功能 用户选择拨打电话或取消

猪宝儿/ 2023年07月17日/ 小程序/ 浏览 693

tt.makePhoneCall是字节小程序调用宿主拨打电话功能,用户选择拨打电话或取消API。


语法


tt.makePhoneCall(options)


代码示例


<button type="default" size="default" bindtap="tapMakePhoneCall">
  拨打电话
</button>


Page({
  tapMakePhoneCall() {
    tt.makePhoneCall({
      phoneNumber: "18888888888",
      success(res) {
        // 调用成功 makePhoneCall:ok
        console.log("调用成功", res.errMsg);
      },
      fail(res) {
        // 调用失败 makePhoneCall:fail
        console.log("调用失败", res.errMsg);
      },
    });
  },
});


Bug & Tip


Tip:回调成功或者回调失败与用户是否拨出电话无关;

Tip:电话号码仅可包含数字,不能使用其它字符。

发表评论

暂无评论,抢个沙发...

客服 工单