flutter 分享到whatsapp
程序员文章站
2022-06-23 14:07:54
android无需额外配置ios:LSApplicationQueriesSchemes whatsapp flutter :需要 url_launcher_launchWhatsapp() async {const url = "https://wa.me/?text=Your Message here";var encod...
android无需额外配置
ios:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
flutter :
需要 url_launcher
_launchWhatsapp() async {
//直接对指定号码发送消息
// 参考: https://api.whatsapp.com/send?phone=$phone&text=${URLEncoder.encode(message, "UTF-8")}
// const url = 'whatsapp://send?phone=$phone';
const url = "https://wa.me/?text=Your Message here";
var encoded = Uri.encodeFull(url);
if (await canLaunch(encoded )) {
await launch(encoded );
} else {
throw 'Could not launch $url';
}
本文地址:https://blog.csdn.net/u011272795/article/details/108876913
上一篇: 产品经理职业生涯规划面试回答(超详解析其面试攻略)
下一篇: 波士顿动力新机器人登场!