-
Notifications
You must be signed in to change notification settings - Fork 4.1k
🐛 [Firebase_Messaging] Background Custom Sound for notification not working android #6831
Copy link
Copy link
Closed
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.resolution: duplicateThis issue or pull request already existsThis issue or pull request already existstype: bugSomething isn't workingSomething isn't working
Description
Bug report
Describe the bug
Hi,
I am using firebase messaging,
When the app in background and i receive a notification. My custom sound not playing. only default notification sound play in android. but in ios it works fine.
Sample project
Steps to reproduce the behavior:
- Inside Menifest
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="high_importance_channel"
android:resource="@raw/car2"/>
- I am using laravel Kreait firebase push notification package
use Kreait\Firebase;
use Kreait\Firebase\Messaging\AndroidConfig;
use Kreait\Firebase\Messaging\ApnsConfig;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;
$notification=Notification::create($request->title,
$request->sub);
$message = CloudMessage::withTarget(“topic”, $promo)->withNotification($notification);
// ‘https://png.pngitem.com/pimgs/s/537-5372546_plant-png-small-transparent-png.png’
$message=$message->withAndroidConfig(
AndroidConfig::new()->withSound(“car2.wav")->withHighPriority()
);
$message=$message->withApnsConfig(ApnsConfig::new()
->withSound(“car2.wav”)
->withBadge(1) );
$messaging->send($message);
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
[✓] Flutter (Channel stable, 2.0.4, on macOS 11.2 20D64 darwin-x64, locale en-AE)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.59.0)
[✓] Connected device (3 available)
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.12.2
Flutter SDK 2.0.4
mrsoolmainapp 1.0.2+5
dependencies:
- awesome_notifications 0.0.6+9 [flutter platform intl]
- cached_network_image 3.0.0 [flutter flutter_cache_manager octo_image]
- crypto 3.0.1 [collection typed_data]
- cupertino_icons 1.0.2
- dio 4.0.0 [http_parser path]
- easy_localization 3.0.0 [flutter shared_preferences intl args path easy_logger flutter_localizations]
- email_validator 2.0.1
- firebase_analytics 8.1.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta]
- firebase_auth 2.0.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.4.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 10.0.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_facebook_auth 1.0.2+2 [flutter]
- flutter_phone_direct_caller 2.0.0 [flutter]
- flutter_spinkit 5.0.0 [flutter]
- geocoder 0.2.1 [meta flutter]
- google_maps_flutter 2.0.5 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- google_sign_in 4.5.9 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- hive 1.6.0-nullsafety.2 [meta crypto]
- hive_flutter 0.3.1 [flutter hive path_provider path]
- image_picker 0.7.5+2 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web]
- intl 0.17.0 [clock path]
- loading_hud 0.2.0 [flutter]
- location 2.5.4 [flutter meta]
- provider 5.0.0 [collection flutter nested]
- pull_to_refresh 2.0.0 [flutter]
- scrollable_positioned_list 0.1.10 [flutter meta]
- sentry_flutter 4.0.6 [flutter flutter_web_plugins sentry package_info]
- shared_preferences 2.0.6 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- showcaseview 0.1.6 [flutter]
- sign_in_with_apple 3.0.0 [flutter meta]
- url_launcher 6.0.5 [flutter meta url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
dev dependencies:
- build_runner 1.11.5 [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_launcher_icons 0.9.0 [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 meta source_span stream_channel string_scanner term_glyph typed_data]
- hive_generator 0.8.2 [build source_gen hive analyzer dartx]
dependency overrides:
- http 0.13.3 [async http_parser meta path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- path_provider 2.0.2 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
transitive dependencies:
- _fe_analyzer_shared 14.0.0 [meta]
- analyzer 0.41.2 [_fe_analyzer_shared args cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- archive 3.1.2 [crypto path]
- args 2.0.0
- async 2.5.0 [collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 1.6.2 [analyzer async convert crypto glob logging meta path]
- build_config 0.4.6 [checked_yaml json_annotation meta path pubspec_parse yaml]
- build_daemon 2.1.10 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 1.5.3 [analyzer build crypto graphs logging meta path package_config pool pub_semver]
- build_runner_core 6.1.10 [async build build_config build_resolvers collection convert crypto glob graphs logging meta path package_config pedantic pool timing watcher yaml]
- built_collection 5.0.0
- built_value 8.0.4 [built_collection collection fixnum]
- characters 1.1.0
- charcode 1.2.0
- checked_yaml 1.0.4 [json_annotation source_span yaml]
- cli_util 0.3.0 [meta path]
- clock 1.1.0
- code_builder 3.7.0 [built_collection built_value collection matcher meta]
- collection 1.15.0
- convert 2.1.1 [charcode typed_data]
- dart_style 1.3.12 [analyzer args path pub_semver source_span]
- dartx 0.7.1 [characters collection crypto meta path time]
- easy_logger 0.0.2 [flutter]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.1
- file 6.1.0 [meta path]
- firebase 9.0.1 [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_auth_platform_interface 5.0.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 2.0.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 3.0.3 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.0.3 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- fixnum 1.0.0
- flutter_blurhash 0.6.0 [flutter meta pedantic]
- flutter_cache_manager 3.1.2 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math]
- flutter_plugin_android_lifecycle 2.0.1 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- glob 2.0.1 [async collection file path pedantic string_scanner]
- google_maps_flutter_platform_interface 2.0.0 [flutter meta plugin_platform_interface stream_transform collection]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- graphs 0.2.0
- http_multi_server 2.2.0 [async]
- image 3.0.2 [archive meta xml]
- image_picker_for_web 2.0.0 [image_picker_platform_interface meta flutter flutter_web_plugins]
- image_picker_platform_interface 2.0.0 [flutter meta http plugin_platform_interface]
- io 0.3.5 [meta path string_scanner]
- js 0.6.3
- json_annotation 4.0.1
- logging 1.0.1
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- mime 1.0.0
- nested 1.0.0 [flutter]
- octo_image 1.0.0+1 [flutter flutter_blurhash]
- package_config 1.9.3 [path charcode]
- package_info 0.4.3+4 [flutter]
- path 1.8.0
- path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 2.0.0 [flutter]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.1 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.11.0
- petitparser 4.1.0 [meta]
- platform 3.0.0
- plugin_platform_interface 2.0.1 [meta]
- pool 1.5.0 [async stack_trace]
- process 4.2.1 [file path platform]
- pub_semver 2.0.0 [collection]
- pubspec_parse 0.1.8 [checked_yaml json_annotation pub_semver yaml]
- quiver 2.1.5 [matcher meta]
- rxdart 0.27.1
- sentry 4.1.0-nullsafety.1 [http meta stack_trace uuid]
- shared_preferences_linux 2.0.0 [flutter file meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 2.0.0 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.0 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 2.0.0 [shared_preferences_platform_interface flutter file meta path path_provider_platform_interface path_provider_windows]
- shelf 1.1.4 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 0.2.4+1 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_gen 0.9.10+3 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0 [charcode collection path term_glyph]
- sqflite 2.0.0+3 [flutter sqflite_common path]
- sqflite_common 2.0.0+2 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- time 2.0.0
- timing 0.1.1+3 [json_annotation]
- typed_data 1.3.0 [collection]
- url_launcher_linux 2.0.0 [flutter]
- url_launcher_macos 2.0.0 [flutter]
- url_launcher_platform_interface 2.0.1 [flutter plugin_platform_interface]
- url_launcher_web 2.0.1 [flutter flutter_web_plugins meta url_launcher_platform_interface]
- url_launcher_windows 2.0.0 [flutter]
- uuid 3.0.4 [crypto]
- vector_math 2.1.0
- watcher 1.0.0 [async path pedantic]
- web_socket_channel 1.2.0 [async crypto stream_channel]
- win32 2.0.5 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.1.2 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.resolution: duplicateThis issue or pull request already existsThis issue or pull request already existstype: bugSomething isn't workingSomething isn't working