Skip to content

Commit 14a7c88

Browse files
stuartmorganyutaaraki-toydium
authored andcommitted
[url_launcher] Update README discussion of permissions (flutter#5424)
1 parent c48e323 commit 14a7c88

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

packages/url_launcher/url_launcher/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 6.1.3
2+
3+
* Updates README section about query permissions to better reflect changes to
4+
`canLaunchUrl` recommendations.
5+
16
## 6.1.2
27

38
* Minor fixes for new analysis options.

packages/url_launcher/url_launcher/README.md

+16-24
Original file line numberDiff line numberDiff line change
@@ -43,55 +43,47 @@ See the example app for more complex examples.
4343
## Configuration
4444

4545
### iOS
46-
Add any URL schemes passed to `canLaunchUrl` as `LSApplicationQueriesSchemes` entries in your Info.plist file.
46+
Add any URL schemes passed to `canLaunchUrl` as `LSApplicationQueriesSchemes`
47+
entries in your Info.plist file, otherwise it will return false.
4748

4849
Example:
4950
```xml
5051
<key>LSApplicationQueriesSchemes</key>
5152
<array>
52-
<string>https</string>
53-
<string>http</string>
53+
<string>sms</string>
54+
<string>tel</string>
5455
</array>
5556
```
5657

5758
See [`-[UIApplication canOpenURL:]`](https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl) for more details.
5859

5960
### Android
6061

61-
Starting from API 30 Android requires package visibility configuration in your
62-
`AndroidManifest.xml` otherwise `canLaunchUrl` will return `false`. A `<queries>`
62+
Add any URL schemes passed to `canLaunchUrl` as `<queries>` entries in your
63+
`AndroidManifest.xml`, otherwise it will return false in most cases starting
64+
on Android 11 (API 30) or higher. A `<queries>`
6365
element must be added to your manifest as a child of the root element.
6466

65-
The snippet below shows an example for an application that uses `https`, `tel`,
66-
and `mailto` URLs with `url_launcher`. See
67-
[the Android documentation](https://developer.android.com/training/package-visibility/use-cases)
68-
for examples of other queries.
69-
67+
Example:
7068
``` xml
7169
<queries>
72-
<!-- If your app opens https URLs -->
70+
<!-- If your app checks for SMS support -->
7371
<intent>
7472
<action android:name="android.intent.action.VIEW" />
75-
<data android:scheme="https" />
73+
<data android:scheme="sms" />
7674
</intent>
77-
<!-- If your app makes calls -->
75+
<!-- If your app checks for call support -->
7876
<intent>
79-
<action android:name="android.intent.action.DIAL" />
77+
<action android:name="android.intent.action.VIEW" />
8078
<data android:scheme="tel" />
8179
</intent>
82-
<!-- If your sends SMS messages -->
83-
<intent>
84-
<action android:name="android.intent.action.SENDTO" />
85-
<data android:scheme="smsto" />
86-
</intent>
87-
<!-- If your app sends emails -->
88-
<intent>
89-
<action android:name="android.intent.action.SEND" />
90-
<data android:mimeType="*/*" />
91-
</intent>
9280
</queries>
9381
```
9482

83+
See
84+
[the Android documentation](https://developer.android.com/training/package-visibility/use-cases)
85+
for examples of other queries.
86+
9587
## Supported URL schemes
9688

9789
The provided URL is passed directly to the host platform for handling. The

packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<data android:scheme="https" />
1515
</intent>
1616
<intent>
17-
<action android:name="android.intent.action.DIAL" />
17+
<action android:name="android.intent.action.VIEW" />
1818
<data android:scheme="tel" />
1919
</intent>
2020
<intent>
21-
<action android:name="android.intent.action.SENDTO" />
22-
<data android:scheme="smsto" />
21+
<action android:name="android.intent.action.VIEW" />
22+
<data android:scheme="sms" />
2323
</intent>
2424
</queries>
2525

packages/url_launcher/url_launcher/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for launching a URL. Supports
33
web, phone, SMS, and email schemes.
44
repository: https://github.com/flutter/plugins/tree/main/packages/url_launcher/url_launcher
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
6-
version: 6.1.2
6+
version: 6.1.3
77

88
environment:
99
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)