Skip to content

Commit 935efb9

Browse files
mvanbeusekomEgor
authored andcommitted
[url_launcher] Document why canLaunch can return false on Android API 30 (flutter#3040)
This PR adds extra documentation to the canLaunch method, explaining that (from Android API 30) false is returned when the package visibility is not managed properly. Starting from Android API 30, apps should explicitly list which other apps it wants to query or interact with, by specifying them in the AndroidManifest.xml file. More information can be found in the Manage package visibility article in the Android documentation.
1 parent e555d7d commit 935efb9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/url_launcher/url_launcher/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.7.2
2+
3+
* Add API documentation explaining the [canLaunch] method returns `false` if package visibility (Android API 30) is not managed correctly.
4+
15
## 5.7.1
26

37
* Keep handling deprecated Android v1 classes for backward compatibility.

packages/url_launcher/url_launcher/lib/url_launcher.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ Future<bool> launch(
109109

110110
/// Checks whether the specified URL can be handled by some app installed on the
111111
/// device.
112+
///
113+
/// On Android (from API 30), [canLaunch] will return `false` when the required
114+
/// visibility configuration is not provided in the AndroidManifest.xml file.
115+
/// For more information see the [Managing package visibility](https://developer.android.com/training/basics/intents/package-visibility)
116+
/// article in the Android docs.
112117
Future<bool> canLaunch(String urlString) async {
113118
if (urlString == null) {
114119
return false;

packages/url_launcher/url_launcher/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: url_launcher
22
description: Flutter plugin for launching a URL on Android and iOS. Supports
33
web, phone, SMS, and email schemes.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher
5-
version: 5.7.1
5+
version: 5.7.2
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)