Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[url_launcher] Update README discussion of permissions #5424

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/url_launcher/url_launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.1.3

* Updates README section about query permissions to better reflect changes to
`canLaunchUrl` recommendations.

## 6.1.2

* Minor fixes for new analysis options.
Expand Down
40 changes: 16 additions & 24 deletions packages/url_launcher/url_launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,55 +43,47 @@ See the example app for more complex examples.
## Configuration

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

Example:
```xml
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
<string>sms</string>
<string>tel</string>
</array>
```

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

### Android

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

The snippet below shows an example for an application that uses `https`, `tel`,
and `mailto` URLs with `url_launcher`. See
[the Android documentation](https://developer.android.com/training/package-visibility/use-cases)
for examples of other queries.

Example:
``` xml
<queries>
<!-- If your app opens https URLs -->
<!-- If your app checks for SMS support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
<data android:scheme="sms" />
</intent>
<!-- If your app makes calls -->
<!-- If your app checks for call support -->
<intent>
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
<!-- If your sends SMS messages -->
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
<!-- If your app sends emails -->
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
```

See
[the Android documentation](https://developer.android.com/training/package-visibility/use-cases)
for examples of other queries.

## Supported URL schemes

The provided URL is passed directly to the host platform for handling. The
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
</queries>

Expand Down
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for launching a URL. Supports
web, phone, SMS, and email schemes.
repository: https://github.com/flutter/plugins/tree/main/packages/url_launcher/url_launcher
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 6.1.2
version: 6.1.3

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down