I Want To Launch Whatsapp Application From My Flutter Application
I am using this dependency url_launcher: ^5.4.1 in my project to launch whatsapp through my flutter application but when i am pressing button to launch application it is not workin
Solution 1:
You are missing the https://
in your url
.
Replace the code below with your url()
method:
String url() {
if (Platform.isAndroid) {
// add the [https]return"https://wa.me/$phone/?text=${Uri.parse(message)}"; // new line
} else {
// add the [https]return"https://api.whatsapp.com/send?phone=$phone=${Uri.parse(message)}"; // new line
}
}
Solution 2:
I found a solution adding this code to android/app/src/main/AndroidManifest.xml
<queries><intent><actionandroid:name="android.intent.action.VIEW" /><dataandroid:scheme="https" /></intent><intent><actionandroid:name="android.intent.action.DIAL" /><dataandroid:scheme="tel" /></intent><intent><actionandroid:name="android.intent.action.SEND" /><dataandroid:mimeType="*/*" /></intent>
Solution 3:
String url() {
if (Platform.isIOS) {
return"whatsapp://wa.me/$phone/?text=${Uri.encodeFull(message)}";
} else {
return"whatsapp://send?phone=$phone&text=${Uri.encodeFull(message)}";
}
}
Post a Comment for "I Want To Launch Whatsapp Application From My Flutter Application"