-
-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
await Permission.notification.request() not showing dialog to grant notification permission on android api version 32 Tiramisu #888
Comments
Any news on that? |
As you probably may know, android permissions API has changed. Now you need to provide more info to the OS. The latest version of this package actually supports this just by adding some info to android config files:
<!-- Permissions options for the `notification` group -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
//...
android {
compileSdkVersion 33
// ...
defaultConfig {
applicationId "your.app.id"
minSdkVersion //your sdk min version
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
// ...
}
|
If someone has the notification permission prompt working, can you please post a screenshot, and Several PR's and comments indicate these changes should be sufficient to make the example app work (currently: 051828f), but they don't seem to help. --- a/permission_handler/example/android/app/src/main/AndroidManifest.xml
+++ b/permission_handler/example/android/app/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
the internet.
-->
<uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<!-- Permissions options for the `contacts` group -->
<uses-permission android:name="android.permission.READ_CONTACTS"/>
diff --git a/permission_handler/example/pubspec.yaml b/permission_handler/example/pubspec.yaml
index f27debc..c356188 100644
--- a/permission_handler/example/pubspec.yaml
+++ b/permission_handler/example/pubspec.yaml
@@ -8,7 +8,7 @@ dependencies:
baseflow_plugin_template:
git:
url: /~https://github.com/Baseflow/baseflow_plugin_template.git
- ref: v2.1.0
+ ref: update-deprecated-button
flutter:
sdk: flutter |
SOLVEDMy emulator was running an SDK that somehow displays as "Android API 33" but also "API 32." After I fixed the SDK, the permission dialog works as expected. Important noteGranting push permission via this plugin may result in a crash due to an unrelated bug in |
Still having this issue with The dialog does not come up at all on android sdk 33 in release mode. It does not make a difference if I add the line to the Manifest or not. |
you saved me a tons of time, I try on my emulator for both android 13 & ios 16.1, all is showing notification request dialog |
Having this issue with await Permission.storage.request().isGranted // Not show anything <!-- These lines added -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> And I found that this problem may caused by android API 33+. |
change compileSdkVersion and targetSdkVersion: showing notification request dialog |
I had applied all above configurations but still not getting the dialogue box for permissions.
I am getting permission status un determined on print |
Seems this is caused by the new introduced Android API level 33 storage permission policy: Granular media permissions. That means the In this case, since the - Permission.storage,
+ Permission.videos, // READ_MEDIA_IMAGES & READ_MEDIA_VIDEO
+ Permission.audio, // READ_MEDIA_AUDIO And in the - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
+ <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
+ <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
+ android:maxSdkVersion="32" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
+ android:maxSdkVersion="29" /> When one of these permissions is granted by user, the App seems ok to access its storage. |
@Xanonymous-GitHub Very thanks!!! pd: i develop from react-native but that solution fix my error. |
Actually, I am facing the same problem. The dependency seems to be working correctly, but the permission dialog does not appear in debug mode or any emulated environment, only on a real phone. In my case, I built an APK and tried it on my Samsung phone. The app is showing the notification permission dialog to ask for permission. Here are the relevant sections from my manifest: <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> And here are the dependencies listed in my pubspec.yaml file: firebase_core: ^2.8.0
firebase_messaging: ^14.3.0
permission_handler: ^10.2.0 |
Some package limits READ_EXTERNAL_STORAGE permission until sdk 29 only, to make sure permission are set in manifest for sdk 30,31 and 32, you could try :
|
@AbishekPerera thank you so much!
|
I have tested the behaviour in the initial post (regarding the "notification" permission) on my Pixel 7a (in both release and debug mode) and the permission seems to work fine. Below are two screenshots, one showing the dialog, second showing the granted permissions after pressing allow: I have used the example application to test (without any changes). Tested with permission_handler version: 10.4.3 Details of my Flutter environment are: flutter doctor -v
Since the POST_NOTIFICATIONS permission seem to work fine, I am going to close this issue. If you do encounter an issue with the notification permission, please create a new issue and fill out the issue template as complete as possible. |
🐛 Bug Report
Calling request() method on Permission.notification does not show system dialog and always returns PermissionStatus.denied on Android 13 (Emulator running API: 32 Tiramisu) and (Emulator running API: 33).
I also run example project from and still not getting dialog
Expected behavior
Notification permission is requested.
Reproduction steps
Create Android Emulator with API 32 and 33, launch the example project, and request notification permission.
Configuration
Version: 10.0.0
Platform:
The text was updated successfully, but these errors were encountered: