From c8dff59c4259fe42faac87646cf078487a6ff612 Mon Sep 17 00:00:00 2001 From: Lakshyajeet Jalal Date: Tue, 30 Apr 2024 22:38:08 +0530 Subject: [PATCH] manifest permissions update --- android/src/main/AndroidManifest.xml | 23 ++++++++--- .../android/app/src/main/AndroidManifest.xml | 38 +++++++++++++++---- example/lib/main.dart | 10 +++-- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 6b83ab6..3f8be95 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,10 +1,21 @@ - - + + + + + + + + + + + - - - - + \ No newline at end of file diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index f743afe..59bf4d5 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,26 @@ + + + + + + + + + + + + + + + + + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> - - + + - - + + - + \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index 0925d62..5873dc8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -61,7 +61,7 @@ class _MyBodyState extends State { ElevatedButton( child: const Text("checkLocationPermission (<= Android 12)"), onPressed: () async { - if (await Permission.location.isGranted) { + if (await Permission.locationWhenInUse.isGranted) { showSnackbar("Location permissions granted :)"); } else { showSnackbar("Location permissions not granted :("); @@ -71,7 +71,9 @@ class _MyBodyState extends State { ElevatedButton( child: const Text("askLocationPermission"), onPressed: () async { - if (await Permission.location.request().isGranted) { + if (await Permission.locationWhenInUse + .request() + .isGranted) { showSnackbar("Location permissions granted :)"); } else { showSnackbar("Location permissions not granted :("); @@ -113,8 +115,8 @@ class _MyBodyState extends State { ), ElevatedButton( child: const Text("askBluetoothPermission (Android 12+)"), - onPressed: () { - [ + onPressed: () async { + await [ Permission.bluetooth, Permission.bluetoothAdvertise, Permission.bluetoothConnect,