[url_launcher] Amend example's manifest and docs (#4006)

diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md
index bbc5f24..1e7104c 100644
--- a/packages/url_launcher/url_launcher/CHANGELOG.md
+++ b/packages/url_launcher/url_launcher/CHANGELOG.md
@@ -1,5 +1,6 @@
-## NEXT
+## 6.0.8
 
+* Adding API level 30 required package visibility configuration to the example's AndroidManifest.xml and README
 * Fix test button check for iOS 15.
 
 ## 6.0.7
diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md
index 20ee0a5..c649b5c 100644
--- a/packages/url_launcher/url_launcher/README.md
+++ b/packages/url_launcher/url_launcher/README.md
@@ -49,6 +49,37 @@
     await canLaunch(_url) ? await launch(_url) : throw 'Could not launch $_url';
 ```
 
+### Android
+
+Starting from API 30 Android requires package visibility configuration in your
+`AndroidManifest.xml` otherwise `canLaunch` will return `false`. 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.
+
+``` xml
+<queries>
+  <!-- If your app opens https URLs -->
+  <intent>
+    <action android:name="android.intent.action.VIEW" />
+    <data android:scheme="https" />
+  </intent>
+  <!-- If your app makes calls -->
+  <intent>
+    <action android:name="android.intent.action.DIAL" />
+    <data android:scheme="tel" />
+  </intent>
+  <!-- If your app emails -->
+  <intent>
+    <action android:name="android.intent.action.SEND" />
+    <data android:mimeType="*/*" />
+  </intent>
+</queries>
+```
+
 ## Supported URL schemes
 
 The [`launch`](https://pub.dev/documentation/url_launcher/latest/url_launcher/launch.html) method
diff --git a/packages/url_launcher/url_launcher/example/android/app/build.gradle b/packages/url_launcher/url_launcher/example/android/app/build.gradle
index 4620c89..8280da8 100644
--- a/packages/url_launcher/url_launcher/example/android/app/build.gradle
+++ b/packages/url_launcher/url_launcher/example/android/app/build.gradle
@@ -25,7 +25,7 @@
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
 android {
-    compileSdkVersion 29
+    compileSdkVersion 30
 
     lintOptions {
         disable 'InvalidPackage'
@@ -34,7 +34,7 @@
     defaultConfig {
         applicationId "io.flutter.plugins.urllauncherexample"
         minSdkVersion 16
-        targetSdkVersion 28
+        targetSdkVersion 30
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
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 3703579..d6753c9 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
@@ -1,6 +1,24 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="io.flutter.plugins.urllauncherexample">
 
+  <!-- The INTERNET permission is required for development. Specifically,
+       flutter needs it to communicate with the running application
+       to allow setting breakpoints, to provide hot reload, etc.
+  -->
+  <uses-permission android:name="android.permission.INTERNET"/>
+
+  <!-- Provide required visibility configuration for API level 30 and above -->
+  <queries>
+    <intent>
+      <action android:name="android.intent.action.VIEW" />
+      <data android:scheme="https" />
+    </intent>
+    <intent>
+      <action android:name="android.intent.action.DIAL" />
+      <data android:scheme="tel" />
+    </intent>
+  </queries>
+
   <!-- io.flutter.app.FlutterApplication is an android.app.Application that
        calls FlutterMain.startInitialization(this); in its onCreate method.
        In most cases you can leave this as-is, but you if you want to provide
@@ -32,9 +50,4 @@
     <meta-data android:name="flutterEmbedding" android:value="2"/>
   </application>
 
-  <!-- The INTERNET permission is required for development. Specifically,
-       flutter needs it to communicate with the running application
-       to allow setting breakpoints, to provide hot reload, etc.
-  -->
-  <uses-permission android:name="android.permission.INTERNET"/>
 </manifest>
diff --git a/packages/url_launcher/url_launcher/example/android/build.gradle b/packages/url_launcher/url_launcher/example/android/build.gradle
index 4d553dd..328175b 100644
--- a/packages/url_launcher/url_launcher/example/android/build.gradle
+++ b/packages/url_launcher/url_launcher/example/android/build.gradle
@@ -5,7 +5,7 @@
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.4.2'
+        classpath 'com.android.tools.build:gradle:4.2.1'
     }
 }
 
diff --git a/packages/url_launcher/url_launcher/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/url_launcher/url_launcher/example/android/gradle/wrapper/gradle-wrapper.properties
index 1cedb28..4ae10e9 100644
--- a/packages/url_launcher/url_launcher/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/packages/url_launcher/url_launcher/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
diff --git a/packages/url_launcher/url_launcher/lib/url_launcher.dart b/packages/url_launcher/url_launcher/lib/url_launcher.dart
index b59c91d..e8d9670 100644
--- a/packages/url_launcher/url_launcher/lib/url_launcher.dart
+++ b/packages/url_launcher/url_launcher/lib/url_launcher.dart
@@ -117,8 +117,10 @@
 ///
 /// On Android (from API 30), [canLaunch] will return `false` when the required
 /// visibility configuration is not provided in the AndroidManifest.xml file.
-/// For more information see the [Managing package visibility](https://developer.android.com/training/basics/intents/package-visibility)
-/// article in the Android docs.
+/// For more information see the
+/// [Package visibility filtering on Android](https://developer.android.com/training/basics/intents/package-visibility)
+/// article in the Android documentation or the url_launcher example app's
+/// [AndroidManifest.xml's queries element](https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml).
 Future<bool> canLaunch(String urlString) async {
   return await UrlLauncherPlatform.instance.canLaunch(urlString);
 }
diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml
index a2facbd..28dc71c 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/master/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.0.7
+version: 6.0.8
 
 environment:
   sdk: ">=2.12.0 <3.0.0"