Flutter调用短信、电话等

插件地址:https://pub.flutter-io.cn/packages/url_launcher#-readme-tab-

body: ListView(
          children: <Widget>[
            MyRowText("打电话", () => doCall('tel:+1 555 010 999')),
            MyRowText("发短信", () => doCall('sms:5550101234')),
            //subject 主题 ;body内容
            MyRowText("发邮件", () => doCall('mailto:smith@example.org?subject=News&body=New%20plugin')),
            MyRowText("跳转浏览器", () => doCall('http://www.baidu.com')),
            MyRowText("跳转安卓App", () => doCall('ssbdapp://jump.com/communityhome')),
          ],
        ),
doCall(url) async {
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

码云地址:https://gitee.com/xgljh/Flutter.git

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容