i am trying to open messenger and WhatsApp using launchUrl()
method from the URL_Launch plugin but every time i try the browser opens and show this message:
The webpage at intent://user/562084722.?intent_trigger=mme#intent;scheme=fb-messenger;package=com.facebook.orca;end could not be loaded because: net::ERR_UNKOWN_URL_SCHEME
this is the code :
//Call Directly
_directCall() {
launchUrl(Uri.parse('tel:00962785522213'));
}
//Open WhatsApp
_launchWhatsapp() {
launchUrl(Uri.parse("https://wa.me/ 962797809910"));
}
//Open Messenger
_openMessenger() {
launchUrl(Uri.parse('https://m.me/amr.al.shugran'));
}
//open email
_openGmail() {
final Uri emailLaunchUri =
Uri(scheme: 'mailto', path: '[email protected]', queryParameters: {
'subject': 'Inquiry',
});
launchUrl(emailLaunchUri);
}
the direct call and gmail are working fine, but whatsApp and messenger shows the error above so am not sure what format i should use to make it works, ill appreciate any help.
note: if i put for example "https://google.com", it opens without any issues. also if i use the old method launch()
it also works with messenger and WhatsApp.
CodePudding user response:
you need to configure you androidManifest.xml file check this URL https://pub.dev/packages/url_launcher
example
<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
<!-- If your app checks for SMS support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
<!-- If your app checks for call support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
</queries>
CodePudding user response:
For messenger you should add this to your manifest file:
<queries>
<provider
android:authorities="com.facebook.katana.provider.PlatformProvider"
android:exported="false" />
</queries>