flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Permission Handler Notfication not working

Open Sania-Developer opened this issue 2 years ago • 7 comments

I want to show the dialog asking the user to allow the notification. The package is working fine for the camera, microphone, etc but it's not working for notification.

Sania-Developer avatar Aug 23 '22 18:08 Sania-Developer

I also had this problem with the ^10.0.0 version! But I tried using an older version :6.0.1 to fix this problem.

chuanzige avatar Aug 24 '22 02:08 chuanzige

I want to show the dialog asking the user to allow the notification. The package is working fine for the camera, microphone, etc but it's not working for notification.

in ^10.0.0 their documents mention this - Some permissions will not show a dialog asking the user to allow or deny the requested permission. This is because the OS setting(s) of the app are being retrieved for the corresponding permission. The status of the setting will determine whether the permission is granted or denied.

The following permissions will show no dialog:

Notification Bluetooth The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status:

manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy

deevsaini avatar Aug 24 '22 12:08 deevsaini

I also had this problem with the ^10.0.0 version! But I tried using an older version :6.0.1 to fix this problem.

I tried it with the older version but it still does not work for me.

Sania-Developer avatar Aug 24 '22 14:08 Sania-Developer

I want to show the dialog asking the user to allow the notification. The package is working fine for the camera, microphone, etc but it's not working for notification.

in ^10.0.0 their documents mention this - Some permissions will not show a dialog asking the user to allow or deny the requested permission. This is because the OS setting(s) of the app are being retrieved for the corresponding permission. The status of the setting will determine whether the permission is granted or denied.

The following permissions will show no dialog:

Notification Bluetooth The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status:

manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy

Is there any way to show a dialog asking for permission to allow notification using a permission handler?

Sania-Developer avatar Aug 24 '22 14:08 Sania-Developer

I want to show the dialog asking the user to allow the notification. The package is working fine for the camera, microphone, etc but it's not working for notification.

in ^10.0.0 their documents mention this - Some permissions will not show a dialog asking the user to allow or deny the requested permission. This is because the OS setting(s) of the app are being retrieved for the corresponding permission. The status of the setting will determine whether the permission is granted or denied. The following permissions will show no dialog: Notification Bluetooth The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status: manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy

Is there any way to show a dialog asking for permission to allow notification using a permission handler?

even contact permissions have stopped showing a dialog for me !

deevsaini avatar Aug 25 '22 05:08 deevsaini

I want to show the dialog asking the user to allow the notification. The package is working fine for the camera, microphone, etc but it's not working for notification.

in ^10.0.0 their documents mention this - Some permissions will not show a dialog asking the user to allow or deny the requested permission. This is because the OS setting(s) of the app are being retrieved for the corresponding permission. The status of the setting will determine whether the permission is granted or denied. The following permissions will show no dialog: Notification Bluetooth The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status: manageExternalStorage systemAlertWindow requestInstallPackages accessNotificationPolicy

Is there any way to show a dialog asking for permission to allow notification using a permission handler?

include PERMISSION_NOTIFICATIONS =1 into your iOS/podfile

deevsaini avatar Aug 27 '22 09:08 deevsaini

I tried it with the older version but it still does not work for me.

^10.0.0 版本也有这个问题!但我尝试使用旧版本 :6.0.1 来解决这个问题。

我用旧版本尝试过,但它仍然不适合我。

try to add <key>NSMicrophoneUsageDescription</key> <string>访问麦克风</string> to path:ios->Runner->Info.plist

chuanzige avatar Aug 29 '22 02:08 chuanzige

This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY

myselfuser1 avatar Mar 17 '23 12:03 myselfuser1

Dear @Sania-Developer,

Can you inform us about the platform where you are experiencing this issue? Furthermore, please add this output of flutter doctor -v to this issue. It helps a lot during investigation of this issue.

TimHoogstrate avatar Aug 22 '23 09:08 TimHoogstrate

I also experience the issue on android. Here's my device info

  • Android version: 13
  • Device: Oppo
  • Model: CPH2333

flutter doctor -v:

[✓] Flutter (Channel stable, 3.10.5, on Mac OS X 10.15.7 19H2026 darwin-x64, locale en-KH)
    • Flutter version 3.10.5 on channel stable at /Users/apple/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (3 months ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/apple/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/apple/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 12D4e
    ✗ Flutter requires Xcode 13 or higher.
      Download the latest version or update via the Mac App Store.
    ! CocoaPods 1.10.1 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • CPH2333 (mobile) • 2cd77615 • android-arm64  • Android 13 (API 33)
    • macOS (desktop)  • macos    • darwin-x64     • Mac OS X 10.15.7 19H2026 darwin-x64
    • Chrome (web)     • chrome   • web-javascript • Google Chrome 116.0.5845.110

[✓] Network resources
    • All expected network resources are available.

  • Package version: 10.4.3

chounry avatar Aug 29 '23 09:08 chounry

@chounry,

Can you try to test it with the example app. It forks on my testing device Android 13.

Kind regards,

TimHoogstrate avatar Aug 29 '23 11:08 TimHoogstrate

@TimHoogstrate

Yes. I tried it and it works. So it seems that I did something wrong, but I couldn't find it.

I already put <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> in the app/src/main/AndroidManifest.xml

When calling await Permission.notification.request(), the result always return denied immediately without the popup dialog. By the way, the isPermanentlyDenied is false. When I try await Permission.locationWhenInUse.request() it shows the popup.

Could it be because of conflict between packages?

chounry avatar Aug 30 '23 04:08 chounry

I have fixed it. I increase the targetSdkVersion in app/build.gradle to 33.

chounry avatar Aug 31 '23 08:08 chounry

Closing the issue as it was resolved per comment above.

mvanbeusekom avatar Sep 12 '23 13:09 mvanbeusekom