plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[url_launcher] Add non-browser URL launch mode for Android

Open Mosc opened this issue 2 years ago • 4 comments

Adds support for LaunchMode.externalNonBrowserApplication to url_launcher on Android by acting on the universalLinksOnly parameter that was already being passed to the method channel. Simply adds Intent.FLAG_ACTIVITY_REQUIRE_NON_BROWSER on Android R and up, but requires a fallback on lower versions. The fallback works by querying the package manager for which apps can handle the intent, and only considering those apps that don't handle just any HTTPS URL. If the resulting list is non-empty, a suitable non-browser app has been found.

Fixes https://github.com/flutter/flutter/issues/66721.

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • [x] I signed the CLA.
  • [x] The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • [x] I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I added new tests to check the change I am making, or this PR is test-exempt.
  • [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Mosc avatar Jun 11 '22 21:06 Mosc

The PR referenced above has landed, so you can update this to implement the new API now. (It won't currently work from the app-facing package, but that will be resolved shortly with https://github.com/flutter/plugins/pull/5985 so development of this can proceed in parallel.)

stuartmorgan avatar Jun 17 '22 20:06 stuartmorgan

The app-facing package PR has also landed, so an updated version of this would work end to end.

stuartmorgan avatar Jun 23 '22 20:06 stuartmorgan

@Mosc Are you planning on updating this PR to implement use the new API?

stuartmorgan avatar Jul 20 '22 14:07 stuartmorgan

Yes, but it's bit low on my priority list, and with limited time available I haven't got around to restructuring the PR yet. I would not mind if you or someone else takes over in the meantime.

Mosc avatar Jul 22 '22 13:07 Mosc

@Mosc I'm going to close this PR for now to get it off our review queue, but please don't hesitate to submit a new PR if you have the time to get back to it. In the meantime I'll mention this PR on the issue so that anyone else who wants to pick it up can do so. Thanks again for your contribution!

Hixie avatar Oct 25 '22 23:10 Hixie