'Flutter - Not opening join whatsapp group
I have a webView that contains links to join a whatsapp group and in chrome is working, but when I run the flutter app (iOS and Android) is not prompting the whatsapp App it says looks like you do not have whatsapp installed.
What I'm missing? I have this on my webview :
WebView(
javascriptMode: JavascriptMode.unrestricted,
initialUrl: 'https://myWeb',
onWebViewCreated: (controller) {
this.controller = controller;
},
navigationDelegate: (NavigationRequest request) async {
print(request.url);
if (request.url.startsWith('whatsapp://chat')) {
await _launchURL(request.url);
}
},
),
....
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
I had to use this launch because otherwise it was showing a message as "can not open whatsapp://..."
I've added on manifest.xml
<queries>
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<!-- If your app makes calls -->
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<!-- If your sends SMS messages -->
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
<!-- If your app sends emails -->
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
And in info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
</array>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
