Closed hosseinkhojany closed 1 year ago
Hi @hosseinkhojany, since the plugin example works as expected this is likely an issue with how you configured your application. Can you share your code? As without a complete minimal reproducible code sample, we cannot diagnose this issue.
No, unfortunately, I can't share the code, but this problem is very strange and I have to restart the program to solve the problem. If I don't restart, the program shows a black screen.
The only difference between my code and your code is that I put the function to receive the message when the app is closed in another class not in main class. Can it be from this?
Hi @hosseinkhojany, does your backgroundMessageHandler conform to the rules specified in https://firebase.flutter.dev/docs/messaging/usage#background-messages?
Hi @hosseinkhojany, can you try producing a minimal sample code from your project? Maybe that could help us discover why your backgroundMessageHandler is not working properly
When I removed this line of code from the manifest, the main function is no longer executed and the behavior of the program is fixed
<service
android:name="com.ryanheise.audioservice.AudioService"
android:exported="true"
tools:ignore="Instantiatable">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
package: audio_service: ^0.18.7
Hi @hosseinkhojany, if that is the case, I think you should report this issue on the audio_service
repo so they can investigate it.
Given that this issue seems to be caused by a third-party plugin, I'll be closing this issue.
If you are redirected here after reporting this on their end, kindly leave a comment below and I will reopen this issue.
Thank you
Bug report
Describe the bug When the program is completely closed and I receive a message from fcm, the program's main function is executed automatically, and this is very bad for my program. I tested the firebase_messaging example and it works correctly, it is not starting the main method. Why is it happening in my code?
My code is similar to the implemented Git example https://github.com/firebase/flutterfire/tree/master/packages/firebase_messaging
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` [β] Flutter (Channel stable, 3.0.2, on Ubuntu 20.04.3 LTS 5.4.0-050400-generic, locale en_US.UTF-8) β’ Flutter version 3.0.2 at /home/khoujani/Documents/flutter/3.0.3 β’ Upstream repository https://github.com/flutter/flutter.git β’ Framework revision cd41fdd495 (5 months ago), 2022-06-08 09:52:13 -0700 β’ Engine revision f15f824b57 β’ Dart version 2.17.3 β’ DevTools version 2.12.2 [!] Android toolchain - develop for Android devices (Android SDK version 33.0.0) β’ Android SDK at /usr/lib/android-sdk β cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. β Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/linux#android-setup for more details. [β] Chrome - develop for the web β’ Chrome at google-chrome [β] Linux toolchain - develop for Linux desktop β’ clang version 10.0.0-4ubuntu1 β’ cmake version 3.16.3 β’ ninja version 1.10.0 β’ pkg-config version 0.29.1 [β] Android Studio (version 2021.1) β’ Android Studio at /home/khoujani/ANDROID/android-2021.1.1 β’ Flutter plugin version 64.0.2 β’ Dart plugin version 211.7798 β’ Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) [β] VS Code β’ VS Code at /snap/code/current β’ Flutter extension version 3.44.0 [β] Connected device (3 available) β’ M2010J19CG (mobile) β’ c0b33e21120 β’ android-arm64 β’ Android 10 (API 29) β’ Linux (desktop) β’ linux β’ linux-x64 β’ Ubuntu 20.04.3 LTS 5.4.0-050400-generic β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 105.0.5195.125 [β] HTTP Host Availability β’ All required HTTP hosts are available ! Doctor found issues in 1 category. ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.17.3 Flutter SDK 3.0.2 myelin 2.1.4+159 dependencies: - audio_service 0.18.7 [audio_service_platform_interface audio_service_web audio_session rxdart flutter_cache_manager clock js flutter flutter_web_plugins] - background_fetch 1.0.1 [flutter] - cached_network_image 3.2.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - chewie 1.3.5 [cupertino_icons flutter provider video_player wakelock] - crop_image 1.0.2 [flutter meta] - custom_pop_up_menu 1.2.3+1 [flutter] - dio 4.0.6 [http_parser path] - division 0.9.0 [flutter] - email_launcher 1.1.1 [flutter] - emoji_picker_flutter 1.3.0 [flutter shared_preferences] - equatable 2.0.5 [collection meta] - file_picker 4.6.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_analytics 8.3.4 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta] - firebase_core 1.24.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_messaging 13.1.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - 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_linear_datepicker 2.0.3 [flutter shamsi_date] - flutter_local_notifications 11.0.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_picker 2.0.5 [flutter] - flutter_ringtone_player 3.2.0 [flutter path_provider] - flutter_staggered_animations 1.0.0 [flutter] - flutter_staggered_grid_view 0.4.1 [flutter] - flutter_svg 0.22.0 [flutter meta path_drawing vector_math xml] - flutter_swipe_action_cell 2.2.3 [flutter] - flutter_time_picker_spinner 2.0.0 [flutter] - flutter_typeahead 3.2.7 [flutter flutter_keyboard_visibility] - get 4.6.5 [flutter] - get_it 7.2.0 [async collection] - hive 2.2.3 [meta crypto] - html 0.15.0 [csslib source_span] - http 0.13.5 [async http_parser meta path] - image_cropper 2.0.3 [flutter image_cropper_platform_interface image_cropper_for_web] - image_picker 0.7.5+4 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web] - image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface] - iran_appmarket 0.4.1 [flutter get_version android_intent] - just_audio 0.9.28 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid crypto meta flutter] - keyboard_avoider 0.1.2 [flutter] - laravel_flutter_pusher 0.0.4 [flutter json_annotation] - loading_overlay 0.3.0 [flutter] - map_launcher 2.3.0+1 [flutter] - marquee_text 2.5.0+1 [flutter] - marquee_widget 1.2.0 [flutter] - package_info 2.0.2 [flutter] - path 1.8.1 - 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 8.3.0 [flutter meta permission_handler_platform_interface] - persian_datepicker 1.3.1 [flutter] - photo_manager 2.2.1 [flutter] - photo_view 0.12.0 [flutter] - pin_code_fields 7.4.0 [flutter] - provider 6.0.3 [collection flutter nested] - pull_to_refresh 2.0.0 [flutter] - record 3.0.4 [flutter record_platform_interface record_web] - restart_app 1.1.0+1 [flutter plugin_platform_interface flutter_web_plugins] - scrollable_positioned_list 0.2.3 [flutter collection] - shamsi_date 0.15.0 - 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] - sms_autofill 2.2.0 [pin_input_text_field flutter] - sqflite 2.0.2+1 [flutter sqflite_common path] - store_checker 0.1.0 [flutter] - syncfusion_flutter_charts 19.4.56 [flutter intl vector_math syncfusion_flutter_core] - toast 0.1.5 [flutter] - touchable 1.0.2 [flutter] - 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] - video_player 2.4.7 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - wc_flutter_share 0.4.0 [flutter path_provider] - weekday_selector 1.1.0 [flutter] dev dependencies: - flutter_flavorizr 2.1.3 [flutter archive args checked_yaml collection image io json_annotation sprintf xml yaml] - flutter_launcher_icons 0.9.3 [args image path yaml] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - hive_test 1.0.1 [flutter hive path] transitive dependencies: - _flutterfire_internals 1.0.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - android_intent 2.0.2 [flutter platform meta] - archive 3.3.1 [crypto path] - args 2.3.1 - async 2.8.2 [collection meta] - audio_service_platform_interface 0.1.0 [flutter plugin_platform_interface meta] - audio_service_web 0.1.1 [audio_service_platform_interface rxdart js flutter flutter_web_plugins] - audio_session 0.1.10 [flutter flutter_web_plugins rxdart meta] - boolean_selector 2.1.0 [source_span string_scanner] - cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.2.0 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - clock 1.1.0 - cloud_firestore_platform_interface 5.7.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 2.8.10 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.16.0 - cross_file 0.3.3+1 [js meta] - crypto 3.0.2 [typed_data] - csslib 0.17.2 [source_span] - cupertino_icons 1.0.5 - dbus 0.7.3 [args ffi meta xml] - fake_async 1.3.0 [clock collection] - ffi 1.2.1 - file 6.1.4 [meta path] - firebase 9.0.3 [http http_parser js] - firebase_analytics_platform_interface 2.0.1 [flutter meta] - firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta] - firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 1.7.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 4.2.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.2.0 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - flutter_blurhash 0.7.0 [flutter] - flutter_keyboard_visibility 5.3.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web 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 1.0.0 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories] - flutter_local_notifications_platform_interface 6.0.0 [flutter plugin_platform_interface] - flutter_plugin_android_lifecycle 2.0.7 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - get_version 0.0.8+4 [package_info flutter] - http_parser 4.0.1 [collection source_span string_scanner typed_data] - image 3.1.3 [archive meta xml] - image_cropper_for_web 0.0.4 [flutter flutter_web_plugins image_cropper_platform_interface js] - image_cropper_platform_interface 2.0.0 [flutter plugin_platform_interface http] - image_picker_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - intl 0.17.0 [clock path] - io 1.0.3 [meta path string_scanner] - js 0.6.4 - json_annotation 4.6.0 [meta] - 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] - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.4 - meta 1.7.0 - mime 1.0.2 - nested 1.0.0 [flutter] - octo_image 1.0.2 [flutter flutter_blurhash] - path_drawing 0.5.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.2.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.0.7 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface] - petitparser 4.4.0 [meta] - pin_input_text_field 4.2.0 [flutter] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - process 4.2.4 [file path platform] - record_platform_interface 0.2.0 [flutter plugin_platform_interface] - record_web 0.2.1 [flutter flutter_web_plugins record_platform_interface] - rxdart 0.26.0 - 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] - sky_engine 0.0.99 - source_span 1.8.2 [collection path term_glyph] - sprintf 6.0.2 - sqflite_common 2.2.1+1 [synchronized path meta] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - syncfusion_flutter_core 19.4.56 [vector_math flutter] - synchronized 3.0.0+3 - term_glyph 1.2.0 - test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timezone 0.9.0 [path] - typed_data 1.3.0 [collection] - 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] - wakelock 0.6.2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows] - 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] - win32 2.5.2 [ffi] - xdg_directories 0.2.0+2 [meta path process] - xml 5.3.1 [collection meta petitparser] - yaml 3.1.1 [collection source_span string_scanner] ```