Skip to content
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

🐛 [firebase_messanging] request permission #3888

Closed
danielwalczak opened this issue Oct 16, 2020 · 6 comments · Fixed by #4012
Closed

🐛 [firebase_messanging] request permission #3888

danielwalczak opened this issue Oct 16, 2020 · 6 comments · Fixed by #4012
Labels

Comments

@danielwalczak
Copy link

danielwalczak commented Oct 16, 2020

Bug report

Describe the bug
is _firebaseMessaging.requestNotificationPermissions working as expected? I never saw this dialog asking for permissions, but seems like notifications are granted and I receive them properly. I have problem to test and see if the user will receive this popup properly.

  1. Go to '...'
  2. '...'
  3. See error or incorrect behavior

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.6 19G73, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.50.1)
[✓] Connected device (1 available)

Flutter dependencies

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

Click To Expand
Changing current working directory to: /Users/midiflow/workspace/mobile
Dart SDK 2.10.1
Flutter SDK 1.22.1
sportshi 2.0.0+16

dependencies:
- animations 1.1.2 [flutter]
- auto_size_text 2.1.0 [flutter]
- cupertino_icons 1.0.0
- device_info 0.4.2+8 [flutter device_info_platform_interface]
- dio 3.0.10 [http_parser path]
- exif 1.0.3 [args collection convert sprintf]
- file_picker 2.0.7 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface]
- firebase_analytics 6.0.2 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface]
- firebase_core 0.5.0+1 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_dynamic_links 0.6.0+2 [flutter firebase_core]
- firebase_messaging 7.0.3 [meta flutter firebase_core]
- flash 1.3.1 [flutter]
- flick_video_player 0.1.1 [flutter video_player provider wakelock]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_form_builder 3.14.0 [flutter flutter_typeahead intl flutter_chips_input datetime_picker_formfield flutter_colorpicker signature validators date_range_picker flutter_touch_spin image_picker image_picker_for_web rating_bar country_pickers phone_number]
- flutter_masked_text 0.8.0 [flutter]
- flutter_mixpanel 0.2.0+3 [flutter json_annotation]
- flutter_mobx 1.1.0+2 [mobx flutter]
- flutter_parsed_text 1.2.4 [flutter]
- flutter_slidable 0.5.7 [flutter]
- flutter_svg 0.19.0 [path_drawing xml vector_math meta flutter]
- get_it 5.0.1 [async meta]
- google_fonts 1.1.0 [flutter http path_provider crypto pedantic]
- image_picker 0.6.7+12 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- injectable 1.0.5 [get_it]
- intl 0.16.1 [path]
- inview_notifier_list 1.0.0 [flutter stream_transform]
- json_annotation 3.0.1
- mobx 1.2.1+3 [meta]
- modal_bottom_sheet 0.2.0 [flutter]
- page_transition 1.1.7+2 [flutter]
- path_provider 1.6.18 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- percent_indicator 2.1.7+4 [flutter]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- share 0.6.5+2 [meta mime flutter]
- shared_preferences 0.5.12 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- shimmer 1.1.2 [flutter]
- transparent_image 1.0.0
- url_launcher 5.7.2 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]
- video_player 0.10.12+5 [meta video_player_platform_interface video_player_web flutter]
- video_thumbnail 0.2.2 [flutter]
- visibility_detector 0.1.5 [flutter]
- web_socket_channel 1.1.0 [async crypto stream_channel]

dev dependencies:
- build_runner 1.10.2 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- flutter_flavorizr 1.0.7 [flutter archive args checked_yaml io json_annotation xml yaml]
- flutter_launcher_icons 0.8.1 [image args yaml path]
- flutter_native_splash 0.1.9 [yaml image color]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
- injectable_generator 1.0.5 [build source_gen path glob analyzer injectable collection]
- json_serializable 3.4.1 [analyzer build build_config json_annotation meta path source_gen]
- json_serializable_mobx 0.2.0 [json_serializable json_annotation json_serializable_type_helper_utils mobx build_runner source_gen analyzer build]
- mobx_codegen 1.1.1+1 [analyzer build build_resolvers meta mobx path source_gen]

dependency overrides:
- image_picker 0.6.7+12 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]

transitive dependencies:
- _fe_analyzer_shared 7.0.0 [meta]
- analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml]
- archive 2.0.13 [crypto args path]
- args 1.6.0
- asn1lib 0.6.5
- async 2.5.0-nullsafety.1 [collection]
- basic_utils 2.6.3 [http logging json_annotation pointycastle asn1lib convert crypto]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- build 1.3.0 [analyzer async convert crypto logging meta path glob]
- build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml]
- build_daemon 2.1.4 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 1.3.11 [analyzer build crypto graphs logging path package_config pub_semver]
- build_runner_core 6.0.1 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pedantic pool timing watcher yaml]
- built_collection 4.3.2 [collection quiver]
- built_value 7.1.0 [built_collection collection fixnum quiver]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- checked_yaml 1.0.2 [json_annotation source_span yaml]
- cli_util 0.2.0 [path]
- clock 1.1.0-nullsafety.1
- code_builder 3.5.0 [built_collection built_value collection matcher meta]
- collection 1.15.0-nullsafety.3
- color 2.1.1
- convert 2.1.1 [charcode typed_data]
- country_pickers 1.3.0 [flutter]
- crypto 2.1.5 [collection convert typed_data]
- csslib 0.16.2 [source_span]
- dart_style 1.3.6 [analyzer args path source_span]
- date_range_picker 1.0.6 [flutter]
- datetime_picker_formfield 1.0.0 [flutter intl]
- device_info_platform_interface 1.0.1 [flutter meta plugin_platform_interface]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase 7.3.0 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- fixnum 0.10.11
- flutter_chips_input 1.9.4 [flutter]
- flutter_colorpicker 0.3.4 [flutter]
- flutter_keyboard_visibility 3.2.2 [flutter]
- flutter_plugin_android_lifecycle 1.0.11 [flutter]
- flutter_touch_spin 1.0.1 [flutter intl]
- flutter_typeahead 1.8.8 [flutter flutter_keyboard_visibility]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- graphs 0.2.0
- html 0.14.0+4 [csslib source_span]
- http 0.12.2 [http_parser path pedantic]
- http_multi_server 2.2.0 [async]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.18 [archive xml meta]
- image_picker_for_web 0.1.0+2 [image_picker_platform_interface flutter flutter_web_plugins meta js]
- image_picker_platform_interface 1.1.1 [flutter meta http plugin_platform_interface]
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.2
- json_serializable_type_helper_utils 1.0.1 [analyzer json_serializable]
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- mime 0.9.7
- nested 0.0.4 [flutter]
- node_interop 1.1.1 [js]
- node_io 1.1.1 [node_interop path]
- package_config 1.9.3 [path charcode]
- path 1.8.0-nullsafety.1
- path_drawing 0.4.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.1.4 [vector_math meta]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+4 [flutter]
- path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+1 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- phone_number 0.6.3 [flutter]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- pointycastle 1.0.2
- pool 1.4.0 [async stack_trace]
- process 3.0.13 [file intl meta path platform]
- provider 4.3.2+2 [flutter nested collection]
- pub_semver 1.4.4 [collection]
- pubspec_parse 0.1.5 [checked_yaml json_annotation pub_semver yaml]
- quiver 2.1.3 [matcher meta]
- random_string 2.1.0
- rating_bar 0.2.0 [flutter]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+1 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- shelf 0.7.9 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel]
- signature 3.2.0 [flutter image]
- sky_engine 0.0.99
- source_gen 0.9.7+1 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sprintf 4.1.0
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timing 0.1.1+2 [json_annotation]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+1 [flutter]
- url_launcher_macos 0.0.1+8 [flutter]
- url_launcher_platform_interface 1.0.8 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.4+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+1 [flutter]
- validators 2.0.1 [vin_decoder]
- vector_math 2.1.0-nullsafety.3
- video_player_platform_interface 2.2.0 [flutter meta]
- video_player_web 0.1.4 [flutter flutter_web_plugins meta video_player_platform_interface]
- vin_decoder 0.1.2 [meta basic_utils http random_string]
- wakelock 0.1.4+2 [flutter]
- watcher 0.9.7+15 [async path pedantic]
- win32 1.7.3 [ffi]
- xdg_directories 0.1.2 [meta path process]
- xml 4.5.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]

@danielwalczak danielwalczak added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 16, 2020
@978740431
Copy link

I'm having the same problem, it's all set to ture, but only provisional: true, everything else is false!
And there's no dialog to open the notification permissions.

_firebaseMessaging.getToken() 
method can't get token,token is null

image
image

information:
iphone6s|13.4.1
flutter:1.20.4
firebase_messaging: ^7.0.3

@danielwalczak
Copy link
Author

danielwalczak commented Oct 19, 2020

I have tested Example app, using my existing firebase project and there is no permission modal as well, permissions are not granted. Tested on iOS 14. Please help

Push Messaging token: f1V8e1qlCkOKgRIWfyPb9G:APA91bGMVZPOzRnIdPVjrbwbb-E4QjpNZJAoKHtFEhpNu8RQHWlzAzBQFipnh7n4AzdjY42pDexOGJyYT1Ag5BVXLc-B5gV9aBlGPvM9ETYOb3TVhffP3nrztD0v7wq_8V19QIY_5YVx
2020-10-19 22:04:43.648210+0200 Runner[337:6800] flutter: Settings registered: PushNotificationSettings {sound: false, alert: false, badge: false, provisional: true}

Using permission_handler package as a workaround worked just fine.

@markusaksli-nc
Copy link
Contributor

I can't reproduce this on the latest master 1.24.0-2.0.pre.86.

flutter doctor -v
[✓] Flutter (Channel master, 1.24.0-2.0.pre.86, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-GB)
    • Flutter version 1.24.0-2.0.pre.86 at /Users/markus/development/flutter_master
    • Framework revision dde20448f7 (33 hours ago), 2020-10-20 00:59:56 -0400
    • Engine revision ea2aea1c61
    • Dart version 2.11.0 (build 2.11.0-234.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /Users/markus/Library/Android/sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: /Users/markus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6858069/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

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

[✓] Android Studio (version 4.1)
    • Android Studio at /Users/markus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6858069/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 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (4 available)
    • iPhone SE (2nd generation) (mobile) • B46F1F22-93B0-40C4-8DA7-1C9816E399F7 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • macOS (desktop)                     • macos                                • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web)                    • web-server                           • web-javascript • Flutter Tools
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 86.0.4240.80

• No issues found!

Have you tried uninstalling the app and then installing it again @danielwalczak ?

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 21, 2020
@danielwalczak
Copy link
Author

danielwalczak commented Oct 21, 2020

Hmm maybe on master its working, Im using 1.22. Of course I tried reinstall app etc, as I mentioned before using permission_handler works as expected, but using firebase_messaging it just don't show up.

If this is working in 1.24 the issue might be in the flutter engine and the way modal is trigger, is not compatible with 1.22.

[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.6 19G73, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.50.1)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 21, 2020
@markusaksli-nc
Copy link
Contributor

@danielwalczak Could you please provide your flutter run -v logs in a plain text file?

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 22, 2020
@markusaksli-nc
Copy link
Contributor

markusaksli-nc commented Oct 28, 2020

After updating Xcode to Version 12.1 (12A7403) (iOS 14.1) the dialog no longer opens up. Reproducible on the latest flutter master 1.24.0-4.0.pre.107 and firebase_messaging: ^7.0.3.

flutter doctor -v
[✓] Flutter (Channel master, 1.24.0-4.0.pre.107, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-GB)
    • Flutter version 1.24.0-4.0.pre.107 at /Users/markus/development/flutter_master
    • Framework revision 35a94f70e1 (5 hours ago), 2020-10-27 23:47:04 -0700
    • Engine revision 64e6599910
    • Dart version 2.11.0 (build 2.11.0-260.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /Users/markus/Library/Android/sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: /Users/markus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6858069/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.1)
    • Android Studio at /Users/markus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6858069/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 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (5 available)
    • Nevercode’s iPhone (mobile) • b668e524315069f3db3661ac11ff1f66afafebdb • ios            • iOS 14.1
    • iPhone 12 Pro Max (mobile)  • 1C7EE787-1EC9-427C-AFEE-224EF736BBCA     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
    • macOS (desktop)             • macos                                    • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web)            • web-server                               • web-javascript • Flutter Tools
    • Chrome (web)                • chrome                                   • web-javascript • Google Chrome 86.0.4240.111
    ! Error: Nevercode’s iPhone is busy: Copying cache files from device. Xcode will continue when Nevercode’s iPhone is finished. (code -10)

• No issues found!

Reproduced using the official example on both simulator and physical. The request dialog did not appear and got

flutter: Settings registered: PushNotificationSettings {sound: false, alert: false, badge: false, provisional: true}

printed by onIosSettingsRegistered for

_firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings(
            sound: true, badge: true, alert: true, provisional: true));

Tried calling it multiple times with a button but did not work. Curiously I could not get permission_handler to work on simulator since

print(await Permission.notification.request());

results in

flutter: PermissionStatus.granted

also without the dialog but on physical with a release build it worked just fine.

@markusaksli-nc markusaksli-nc added plugin: in_app_messaging and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 28, 2020
@firebase firebase locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants