-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[url_launcher] Add canLaunch fallback for web on Android #5399
[url_launcher] Add canLaunch fallback for web on Android #5399
Conversation
If `canLaunch` returns false for a web URL on Android, re-queries with a generic URL, since this can happen if there is a custom handler for the queried URL (e.g,. YouTube or Google Maps urls), but the plugin client application doesn't have permission to see that application. Fixes flutter/flutter#93765
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts about removing the calls to canLaunch from android example app unless it's strictly necessary?
Also wrap the calls to launch in a try/catch block, since errors can be issued:
Line 98 in 99feee9
| result.error("NO_ACTIVITY", "Launching a URL requires a foreground activity.", null); |
Since the I'll go ahead and re-sync the Android example with the main example's structural changes as part of this PR though. |
I didn't change that here since the example already |
[url_launcher] Add canLaunch fallback for web on Android
If
canLaunchreturns false for a web URL on Android, re-queries with ageneric URL, since this can happen if there is a custom handler for the
queried URL (e.g,. YouTube or Google Maps urls), but the plugin client
application doesn't have permission to see that application.
Fixes flutter/flutter#93765
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).