Reputation: 670
I am using url_launcher in my flutter app to open an app in iOS App Store, in ios device Url: https://apps.apple.com/se/app/instagram/id389801252
I enabled mode: LaunchMode.externalNonBrowserApplication
to launch the app directly in App Store, it worked before but not now.
launchUrl return false. and same function works well in Android devices but not in iOS
if (await canLaunchUrl(Uri.parse(url))) {
if(externalNonBrowserApplication == true){
await launchUrl(Uri.parse(url), mode: LaunchMode.externalNonBrowserApplication);
}
else {
await launchUrl(Uri.parse(url));
}
} else {
print('Could not launch $url');
}
Flutter version: 3.3.4 url_launcher: 6.1.6 ios: 16
Upvotes: 1
Views: 2645
Reputation: 670
I solved the issue in iOS devices by adding externalApplication
and externalNonBrowserApplication
for Android devices
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
Upvotes: 5