[url_launcher] Update README discussion of permissions (#5424)
diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index 043edeb..d2c4206 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md
@@ -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.
diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 9c9f0b5..9ef6b5a 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md
@@ -43,14 +43,15 @@ ## 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> ``` @@ -58,40 +59,31 @@ ### 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
diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index fa149f9..5c0d0af 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml
@@ -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>
diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 319b6bf..2a7ddcd 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml
@@ -3,7 +3,7 @@ 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"