firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.58k stars 3.94k forks source link

πŸ› [firebase_messaging] getNotificationSettings() not returns AuthorizationStatus.notDetermined on Android 13 #9501

Closed Hwan-seok closed 1 year ago

Hwan-seok commented 1 year ago

Bug report

Describe the bug On Android 13(platform version 33), getNotificationSettings returns AuthorizationStatus.denied in following two situation.

  1. After the user explicitly taps Never ask again on asking permission.
  2. Before asking permission or never tapped Never ask again. This means that the user didn't determine the permission to accept or deny.

But the official Android docs show that it should be differentiated.

If the ContextCompat.checkSelfPermission() method returns PERMISSION_DENIED, call shouldShowRequestPermissionRationale(). If this method returns true, show an educational UI to the user.

But the checkPermission in this plugin is not using shouldShowRequestPermissionRationale() and only checks the permission is actually granted as follows.

  @RequiresApi(api = 33)
  private Boolean checkPermissions() {
    return ContextHolder.getApplicationContext()
            .checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
        == PackageManager.PERMISSION_GRANTED;
  }

Steps to reproduce

Steps to reproduce the behavior:

  1. call FirebaseMessaging.instance.getNotificationSettings() after app install.

  2. you can see the result of AuthorizationStatus.denied

  3. call FirebaseMessaging.instance.requestPermission() and tap Never ask again

  4. call FirebaseMessaging.instance.getNotificationSettings()

  5. you can also see the AuthorizationStatus.denied

Expected behavior

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [βœ“] Flutter (Channel stable, 3.3.0, on macOS 12.4 21F79 darwin-arm, locale ko-KR) β€’ Flutter version 3.3.0 on channel stable at /Users/khs/flutter β€’ Upstream repository https://github.com/flutter/flutter.git β€’ Framework revision ffccd96b62 (10 days ago), 2022-08-29 17:28:57 -0700 β€’ Engine revision 5e9e0e0aa8 β€’ Dart version 2.18.0 β€’ DevTools version 2.15.0 [βœ“] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) β€’ Android SDK at /Users/khs/Library/Android/sdk β€’ Platform android-33, build-tools 32.1.0-rc1 β€’ Java binary at: /Users/khs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/Android Studio.app/Contents/jre/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) β€’ All Android licenses accepted. [βœ“] Xcode - develop for iOS and macOS (Xcode 13.4.1) β€’ Xcode at /Applications/Xcode.app/Contents/Developer β€’ Build 13F100 β€’ CocoaPods version 1.11.3 [βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [βœ“] Android Studio (version 2021.2) β€’ Android Studio at /Users/khs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/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 11.0.12+0-b1504.28-7817840) [βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.1) β€’ IntelliJ at /Users/khs/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app β€’ 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 [βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.1) β€’ IntelliJ at /Users/khs/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.3739.54/IntelliJ IDEA.app β€’ 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 [βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2) β€’ IntelliJ at /Users/khs/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.3345.118/IntelliJ IDEA.app β€’ 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 [βœ“] VS Code (version 1.71.0) β€’ VS Code at /Applications/Visual Studio Code.app/Contents β€’ Flutter extension version 3.48.0 [βœ“] Connected device (4 available) β€’ sdk gphone64 arm64 (mobile) β€’ emulator-5554 β€’ android-arm64 β€’ Android 13 (API 33) (emulator) [βœ“] HTTP Host Availability β€’ All required HTTP hosts are available β€’ No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.18.0 Flutter SDK 3.3.0 lafity_app 3.1.0+783 dependencies: - agora_rtc_engine 5.3.0 [flutter flutter_web_plugins js json_annotation] - amplitude_flutter 3.10.0 [flutter flutter_web_plugins js] - android_id 0.0.7 [flutter] - animated_text_kit 4.2.2 [flutter characters] - another_flushbar 1.10.29 [flutter] - app_install_date 0.1.1 [flutter path_provider] - app_tracking_transparency 2.0.2+4 [flutter] - audio_video_progress_bar 0.10.0 [flutter] - cached_network_image 3.2.2 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - contacts_service 0.6.3 [flutter collection quiver] - crypto 3.0.2 [typed_data] - device_info_plus 4.1.2 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows] - dio 4.0.6 [http_parser path] - easy_debounce 2.0.2+1 - enum_to_string 2.0.1 - equatable 2.0.5 [collection meta] - event_bus 2.0.0 - facebook_app_events 0.17.0 [flutter] - firebase_analytics 9.3.4 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 3.8.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.22.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.8.10 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_dynamic_links 4.3.7 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - firebase_messaging 13.0.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_remote_config 2.0.17 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - fl_chart 0.55.1 [flutter equatable] - flame 1.3.0 [collection flutter meta ordered_set vector_math] - flame_tiled 1.7.2 [collection flame flutter meta tiled xml] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid] - flutter_dotenv 5.0.2 [flutter] - flutter_fgbg 0.2.0 [flutter] - flutter_keyboard_visibility 5.3.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter] - flutter_local_notifications 9.9.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_spinkit 5.1.0 [flutter] - fluttertoast 8.0.9 [flutter flutter_web_plugins] - gallery_saver 2.3.2 [flutter path_provider http path] - get 4.6.5 [flutter] - google_sign_in 5.4.1 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - hexagon 0.2.0-nullsafety.1 [flutter] - hive 2.2.3 [meta crypto] - hive_flutter 1.1.0 [flutter hive path_provider path] - image 3.2.0 [archive meta xml] - image_cropper 3.0.0 [flutter image_cropper_platform_interface image_cropper_for_web] - image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface] - in_app_purchase 3.0.7 [flutter in_app_purchase_android in_app_purchase_platform_interface in_app_purchase_storekit] - in_app_review 2.0.4 [flutter in_app_review_platform_interface] - in_app_update 3.0.0 [flutter] - intl 0.17.0 [clock path] - intl_phone_number_input 0.7.0+2 [flutter libphonenumber_plugin equatable collection] - ios_utsname_ext 2.1.0 [flutter] - json_annotation 4.6.0 [meta] - just_audio 0.9.28 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid crypto meta flutter] - kakao_flutter_sdk 1.2.2 [flutter kakao_flutter_sdk_common kakao_flutter_sdk_auth kakao_flutter_sdk_share kakao_flutter_sdk_navi kakao_flutter_sdk_story kakao_flutter_sdk_talk kakao_flutter_sdk_template kakao_flutter_sdk_user] - liquid_progress_indicator_ns 1.0.0 [flutter] - logger 1.1.0 - lottie 1.4.2 [archive flutter path vector_math] - native_device_orientation 1.1.4 [flutter meta] - nil 1.1.1 [flutter] - package_info_plus 1.4.3+1 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web] - path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - permission_handler 10.0.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface] - pinput 2.2.12 [flutter smart_auth] - platform 3.1.0 - retrofit 3.0.1+1 [dio meta] - retry 3.1.0 - screenshot 1.2.3 [flutter] - sensors_plus 1.3.4+1 [flutter sensors_plus_web sensors_plus_platform_interface] - share 2.0.4 [meta mime flutter] - shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shimmer 2.0.0 [flutter] - sign_in_with_apple 4.1.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web] - stack_trace 1.10.0 [path] - store_redirect 2.0.1 [flutter] - stream_chat_flutter 4.5.0 [cached_network_image characters chewie collection diacritic dio ezanimation file_picker flutter flutter_markdown flutter_portal flutter_slidable flutter_svg http_parser image_gallery_saver image_picker jiffy lottie meta path_provider photo_manager photo_view rxdart share_plus shimmer stream_chat_flutter_core substring_highlight url_launcher video_player video_thumbnail] - stream_chat_localizations 3.3.0 [flutter flutter_localizations stream_chat_flutter] - table_calendar 3.0.7 [flutter intl simple_gesture_detector] - throttling 1.0.0 - tiled 0.8.4 [flutter archive meta xml] - toggleable 2.1.2 [easy_debounce] - touch_indicator 2.0.0 [flutter] - version 3.0.2 - video_player 2.4.7 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - visibility_detector 0.3.3 [flutter] - wakelock 0.6.2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows] - web_socket_channel 2.2.0 [async crypto stream_channel] - webview_flutter 3.0.4 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - wheel_chooser 1.0.0 [flutter] dev dependencies: - build_runner 2.2.0 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - dart_code_metrics 4.17.1 [analyzer analyzer_plugin ansicolor args collection crypto file glob html meta path source_span xml yaml] - fake_async 1.3.1 [clock collection] - flame_test 1.7.0 [flame flutter flutter_test meta test vector_math] - flutter_native_splash 2.2.9 [args flutter flutter_web_plugins html image js lint meta path universal_io xml yaml] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - hive_generator 1.1.3 [build source_gen hive analyzer source_helper] - intl_utils 2.7.0 [analyzer archive args dart_style http intl path petitparser yaml] - json_serializable 6.3.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] - mockingjay 0.3.0 [flutter flutter_test matcher mocktail test] - mocktail 0.3.0 [collection matcher test] - mocktail_image_network 0.3.1 [mocktail] - retrofit_generator 4.0.3+1 [dio source_gen built_collection code_builder tuple retrofit analyzer dart_style build] - very_good_analysis 3.0.1 dependency overrides: - flame 1.3.0 [collection flutter meta ordered_set vector_math] - video_thumbnail 0.5.2 [flutter] - xml 6.1.0 [collection meta petitparser] transitive dependencies: - _fe_analyzer_shared 46.0.0 [meta] - analyzer 4.6.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - analyzer_plugin 0.10.0 [analyzer collection dart_style pub_semver yaml] - ansicolor 2.0.1 - archive 3.3.1 [crypto path] - args 2.3.1 - asn1lib 1.1.0 - async 2.9.0 [collection meta] - audio_session 0.1.10 [flutter flutter_web_plugins rxdart meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.3.0 [analyzer async convert crypto glob logging meta path] - build_config 1.1.0 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.1.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.0.9 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.4.1 [built_collection collection fixnum meta] - cached_network_image_platform_interface 2.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.2 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.2.1 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - chewie 1.3.4 [cupertino_icons flutter provider video_player wakelock] - clock 1.1.1 - code_builder 4.2.0 [built_collection built_value collection matcher meta] - collection 1.16.0 - connectivity_plus 2.3.6+1 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows] - connectivity_plus_linux 1.3.1 [flutter connectivity_plus_platform_interface meta nm] - connectivity_plus_macos 1.2.4 [connectivity_plus_platform_interface flutter] - connectivity_plus_platform_interface 1.2.1 [flutter meta plugin_platform_interface] - connectivity_plus_web 1.2.3 [connectivity_plus_platform_interface flutter_web_plugins flutter] - connectivity_plus_windows 1.2.2 [connectivity_plus_platform_interface flutter] - convert 3.0.2 [typed_data] - coverage 1.5.0 [args logging package_config path source_maps stack_trace vm_service] - cross_file 0.3.3+1 [js meta] - crypto_keys 0.3.0 [pointycastle meta collection quiver] - csslib 0.17.2 [source_span] - cupertino_icons 1.0.5 - dart_style 2.2.3 [analyzer args path pub_semver source_span] - dbus 0.7.8 [args ffi meta xml] - device_info_plus_linux 3.0.0 [device_info_plus_platform_interface file flutter meta] - device_info_plus_macos 3.0.0 [device_info_plus_platform_interface flutter] - device_info_plus_platform_interface 3.0.0 [flutter meta plugin_platform_interface] - device_info_plus_web 3.0.0 [device_info_plus_platform_interface flutter_web_plugins flutter] - device_info_plus_windows 4.1.0 [device_info_plus_platform_interface ffi flutter win32] - diacritic 0.1.3 - encrypt 5.0.1 [args asn1lib clock collection crypto pointycastle] - ezanimation 0.6.0 [flutter] - ffi 2.0.1 - file 6.1.4 [meta path] - file_picker 5.0.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_analytics_platform_interface 3.3.4 [firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.4.2+4 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth_platform_interface 6.7.0 [collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 4.4.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 1.7.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.2.16 [collection firebase_core flutter meta plugin_platform_interface] - firebase_dynamic_links_platform_interface 0.2.3+12 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 4.1.4 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.1.4 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_remote_config_platform_interface 1.1.16 [firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.1.5 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js] - fixnum 1.0.1 - flutter_blurhash 0.7.0 [flutter] - flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter] - flutter_local_notifications_linux 0.5.1 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories] - flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface] - flutter_markdown 0.6.10+5 [flutter markdown meta path] - flutter_plugin_android_lifecycle 2.0.7 [flutter] - flutter_portal 1.1.1 [collection flutter vector_math] - flutter_slidable 2.0.0 [flutter] - flutter_svg 1.1.4 [flutter meta path_drawing vector_math xml] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - freezed_annotation 2.1.0 [collection json_annotation meta] - frontend_server_client 2.1.3 [async path] - glob 2.1.0 [async collection file path string_scanner] - google_sign_in_android 6.1.0 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.5.0 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.3.0 [flutter plugin_platform_interface quiver] - google_sign_in_web 0.10.2 [flutter flutter_web_plugins google_sign_in_platform_interface js] - graphs 2.1.0 [collection] - html 0.15.0 [csslib source_span] - http 0.13.5 [async http_parser meta path] - http_multi_server 3.2.1 [async] - http_parser 4.0.1 [collection source_span string_scanner typed_data] - image_cropper_for_web 1.0.2 [flutter flutter_web_plugins image_cropper_platform_interface js] - image_cropper_platform_interface 3.0.2 [flutter plugin_platform_interface http] - image_gallery_saver 1.7.1 [flutter] - image_picker_android 0.8.5+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface] - image_picker_ios 0.8.6 [flutter image_picker_platform_interface] - image_picker_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - in_app_purchase_android 0.2.3+3 [collection flutter in_app_purchase_platform_interface json_annotation] - in_app_purchase_platform_interface 1.3.1 [flutter plugin_platform_interface] - in_app_purchase_storekit 0.3.2 [collection flutter in_app_purchase_platform_interface json_annotation] - in_app_review_platform_interface 2.0.3 [flutter url_launcher plugin_platform_interface platform] - io 1.0.3 [meta path string_scanner] - jiffy 5.0.0 [intl] - jose 0.3.2 [crypto_keys meta typed_data x509 http http_parser asn1lib collection] - js 0.6.4 - just_audio_platform_interface 4.2.0 [flutter plugin_platform_interface] - just_audio_web 0.4.7 [just_audio_platform_interface flutter flutter_web_plugins] - kakao_flutter_sdk_auth 1.2.2 [flutter json_annotation dio shared_preferences platform crypto kakao_flutter_sdk_common] - kakao_flutter_sdk_common 1.2.2 [flutter json_annotation dio shared_preferences platform package_info_plus crypto encrypt] - kakao_flutter_sdk_navi 1.2.2 [flutter json_annotation dio platform kakao_flutter_sdk_common] - kakao_flutter_sdk_share 1.2.2 [flutter json_annotation dio platform kakao_flutter_sdk_template] - kakao_flutter_sdk_story 1.2.2 [flutter json_annotation dio kakao_flutter_sdk_user] - kakao_flutter_sdk_talk 1.2.2 [flutter json_annotation dio kakao_flutter_sdk_user kakao_flutter_sdk_template] - kakao_flutter_sdk_template 1.2.2 [flutter json_annotation kakao_flutter_sdk_common] - kakao_flutter_sdk_user 1.2.2 [flutter json_annotation dio kakao_flutter_sdk_auth] - libphonenumber 2.0.2 [flutter meta] - libphonenumber_platform_interface 0.3.1 [flutter plugin_platform_interface] - libphonenumber_plugin 0.2.3 [flutter flutter_web_plugins libphonenumber_platform_interface libphonenumber_web libphonenumber] - libphonenumber_web 0.2.0+1 [flutter flutter_web_plugins js libphonenumber_platform_interface] - lint 1.10.0 - logging 1.0.2 - markdown 5.0.0 [args charcode meta] - matcher 0.12.12 [stack_trace] - material_color_utilities 0.1.5 - meta 1.8.0 - mime 1.0.2 - nested 1.0.0 [flutter] - nm 0.5.0 [dbus] - node_preamble 2.0.1 - octo_image 1.0.2 [flutter flutter_blurhash] - ordered_set 5.0.0 - package_config 2.1.0 [path] - package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path] - package_info_plus_macos 1.3.0 [flutter] - package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface] - package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface] - package_info_plus_windows 2.1.0 [package_info_plus_platform_interface ffi flutter win32] - path 1.8.2 - path_drawing 1.0.1 [vector_math meta path_parsing flutter] - path_parsing 1.0.1 [vector_math meta] - path_provider_android 2.0.20 [flutter path_provider_platform_interface] - path_provider_ios 2.0.11 [flutter path_provider_platform_interface] - path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.6 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface] - path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - permission_handler_android 10.0.0 [flutter permission_handler_platform_interface] - permission_handler_apple 9.0.4 [flutter permission_handler_platform_interface] - permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface] - permission_handler_windows 0.1.0 [flutter permission_handler_platform_interface] - petitparser 5.0.0 [meta] - photo_manager 2.2.1 [flutter] - photo_view 0.14.0 [flutter] - plugin_platform_interface 2.1.2 [meta] - pointycastle 3.6.1 [collection convert js] - pool 1.5.1 [async stack_trace] - process 4.2.4 [file path platform] - provider 6.0.3 [collection flutter nested] - pub_semver 2.1.1 [collection meta] - pubspec_parse 1.2.1 [checked_yaml collection json_annotation pub_semver yaml] - quiver 3.1.0 [matcher] - rate_limiter 0.1.1 - rxdart 0.27.5 - sensors_plus_platform_interface 1.1.1 [flutter meta plugin_platform_interface] - sensors_plus_web 1.1.1 [flutter sensors_plus_platform_interface flutter_web_plugins] - share_plus 4.1.0 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web] - share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher] - share_plus_macos 3.0.1 [share_plus_platform_interface flutter] - share_plus_platform_interface 3.0.3 [flutter meta mime plugin_platform_interface] - share_plus_web 3.0.1 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta] - share_plus_windows 3.0.1 [share_plus_platform_interface flutter meta url_launcher] - shared_preferences_android 2.0.13 [flutter shared_preferences_platform_interface] - shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface] - shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.3.2 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.1 [path shelf shelf_static] - shelf_static 1.1.1 [convert http_parser mime path shelf] - shelf_web_socket 1.0.2 [shelf stream_channel web_socket_channel] - sign_in_with_apple_platform_interface 1.0.0 [flutter plugin_platform_interface meta] - sign_in_with_apple_web 1.0.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface js] - simple_gesture_detector 0.2.0 [flutter] - sky_engine 0.0.99 - smart_auth 1.0.5 [flutter flutter_web_plugins] - source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml] - source_helper 1.3.2 [analyzer collection source_gen] - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.9.0 [collection path term_glyph] - sqflite 2.0.3+1 [flutter sqflite_common path] - sqflite_common 2.2.1+1 [synchronized path meta] - stream_channel 2.1.0 [async] - stream_chat 4.5.0 [async collection dio equatable freezed_annotation http_parser jose json_annotation logging meta mime rate_limiter rxdart uuid web_socket_channel] - stream_chat_flutter_core 4.5.0 [collection connectivity_plus flutter freezed_annotation meta rxdart stream_chat] - stream_transform 2.0.0 - string_scanner 1.1.1 [source_span] - substring_highlight 1.0.33 [flutter] - synchronized 3.0.0+3 - term_glyph 1.2.1 - test 1.21.4 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core] - test_api 0.4.12 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.4.16 [analyzer async args boolean_selector collection coverage frontend_server_client glob io meta package_config path pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - timezone 0.8.0 [path] - timing 1.0.0 [json_annotation] - tuple 2.0.0 [quiver] - typed_data 1.3.1 [collection] - universal_io 2.0.4 [collection crypto meta typed_data] - url_launcher 6.1.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - url_launcher_android 6.0.18 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface] - url_launcher_web 2.0.13 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface] - uuid 3.0.6 [crypto] - vector_math 2.1.2 - video_player_android 2.3.9 [flutter video_player_platform_interface] - video_player_avfoundation 2.3.5 [flutter video_player_platform_interface] - video_player_platform_interface 5.1.4 [flutter plugin_platform_interface] - video_player_web 2.0.12 [flutter flutter_web_plugins video_player_platform_interface] - vm_service 9.4.0 - wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface] - wakelock_platform_interface 0.3.0 [flutter meta] - wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface] - wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32] - watcher 1.0.1 [async path] - webkit_inspection_protocol 1.2.0 [logging] - webview_flutter_android 2.10.0 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 1.9.3 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 2.9.3 [flutter path webview_flutter_platform_interface] - win32 2.7.0 [ffi] - x509 0.2.2 [asn1lib quiver crypto_keys] - xdg_directories 0.2.0+2 [meta path process] - yaml 3.1.1 [collection source_span string_scanner] ```

solikhver commented 1 year ago

I am trying to migrate app to targetSdkVersion 33. Found the same issue. Since Android 13 we have the same notifications permission flow on iOS and Android, but firebase_messaging works inconsistent in that case. It definitely should return AuthorizationStatus.notDetermined on application start on both systems until user provide meaningful response. It already works on iOS, so it would be better to have the same behaviour on Android.

darshankawar commented 1 year ago

@Hwan-seok @solikhver From the documentation, I am not sure if there's a configuration for notDetermined. https://developer.android.com/develop/ui/views/notifications/notification-permission#new-apps

The document also states that If a user installs your app on a device that runs Android 13 or higher, your app's notifications are off by default. ie, for freshly installed app, the status will be denied until permission is granted.

  • getNotificationSettings() should return AuthorizationStatus.notDetermined when user did not explicitly tapped Never ask again(or denied through system after accpeted).

Not sure if there's a way to determine this, ie to check notDetermined status, because I think on Android, there have always been denied or authorized status.

You may just try to see if for Android 13, your app could store an extra bool persistently recording whether or not it's asked for permission.

Hwan-seok commented 1 year ago

@darshankawar

I am not sure if there's a configuration for notDetermined.

You are right, there is no state for notDetermined in native Android. But It could get from shouldShowRequestPermissionRationale().

Here and here says that it would be better(recommended) to prompt the screen before asking permission. To do this, we should call shouldShowRequestPermissionRationale() and if it returns true, it means notDetermined and explicitly denied for false

The latter docs have two code snippets, Minimal and recommended. Through this plugin, we could only implement the minimal version but is not recommended.

darshankawar commented 1 year ago

Thanks for the feedback. Keeping this issue open and labeling for further insights from team.

/cc @russellwheatley

fatherOfLegends commented 1 year ago

I agree that knowing we never asked would be nice to have.

aeaevo commented 1 year ago

What is the status on this issue? ☺️

russellwheatley commented 1 year ago

Hey @Hwan-seok, I took a look at this issue. The following statement is not strictly correct:

Before asking permission or never tapped Never ask again. This means that the user didn't determine the permission to accept or deny.

The user can deny permission but if he doesn't select "Never ask again", then the result of shouldShowRequestPermissionRationale() would be true. So it is entirely possible that the user has denied permission without also responding "Never ask again".

For this reason, I'm hesitant to implement what I think you're requesting. I think you want a true result from shouldShowRequestPermissionRationale() to assign to the property authorizationStatus the value: AuthorizationStatus.notDetermined in the Flutter layer.

As far as I can tell, shouldShowRequestPermissionRationale() should probably be its own separate API. What do you think?

google-oss-bot commented 1 year ago

Hey @Hwan-seok. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

DFelten commented 1 year ago

As far as I can tell, shouldShowRequestPermissionRationale() should probably be its own separate API. What do you think?

I also think a separate call for the query is useful. Currently we have to store for example in local storage whether we have already asked the user. Unfortunately, even that is not enough, since he can also abort the dialog. The separate call would help us here.

google-oss-bot commented 1 year ago

Hey @Hwan-seok. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@Hwan-seok if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Aqua-Ye commented 1 year ago

You can use https://pub.dev/packages/permission_handler which seems to handle it better.