flutter 分享到whatsapp
程序员文章站
2022-03-04 23:35:22
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