• <small id='c7c78'></small><noframes id='c7c78'>

    <i id='c7c78'><tr id='c7c78'><dt id='c7c78'><q id='c7c78'><span id='c7c78'><b id='c7c78'><form id='c7c78'><ins id='c7c78'></ins><ul id='c7c78'></ul><sub id='c7c78'></sub></form><legend id='c7c78'></legend><bdo id='c7c78'><pre id='c7c78'><center id='c7c78'></center></pre></bdo></b><th id='c7c78'></th></span></q></dt></tr></i><div id='c7c78'><tfoot id='c7c78'></tfoot><dl id='c7c78'><fieldset id='c7c78'></fieldset></dl></div>

      1. <legend id='c7c78'><style id='c7c78'><dir id='c7c78'><q id='c7c78'></q></dir></style></legend>
      2. <tfoot id='c7c78'></tfoot>
          <bdo id='c7c78'></bdo><ul id='c7c78'></ul>

        从android中的firebase发送通知时没有通知声音

        时间:2023-07-30
      3. <legend id='bwbB7'><style id='bwbB7'><dir id='bwbB7'><q id='bwbB7'></q></dir></style></legend>
      4. <tfoot id='bwbB7'></tfoot>

                <small id='bwbB7'></small><noframes id='bwbB7'>

                <i id='bwbB7'><tr id='bwbB7'><dt id='bwbB7'><q id='bwbB7'><span id='bwbB7'><b id='bwbB7'><form id='bwbB7'><ins id='bwbB7'></ins><ul id='bwbB7'></ul><sub id='bwbB7'></sub></form><legend id='bwbB7'></legend><bdo id='bwbB7'><pre id='bwbB7'><center id='bwbB7'></center></pre></bdo></b><th id='bwbB7'></th></span></q></dt></tr></i><div id='bwbB7'><tfoot id='bwbB7'></tfoot><dl id='bwbB7'><fieldset id='bwbB7'></fieldset></dl></div>
                  <tbody id='bwbB7'></tbody>

                  <bdo id='bwbB7'></bdo><ul id='bwbB7'></ul>
                  本文介绍了从android中的firebase发送通知时没有通知声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在从 firebase 向我的 Android 应用程序发送推送通知.但是当我的应用程序在后台时,firebase onMessageReceived 方法不会被调用,而是 firebase 向系统发送通知以在系统托盘中显示通知.通知出现在系统托盘中,但没有通知声音,即使我在系统设置中允许我的应用程序发出通知声音.

                  I am sending push notification from firebase to my Android Application. but when my app is in background firebase onMessageReceived method is not called instead firebase send notification to system for showing notification in system tray. notification appears in system tray but no sound for notification even i have allowed notification sound for my app in system settings.

                  当收到来自 firebase 的通知时,我可以做些什么来播放通知声音.

                  what I can do to play notification sound when notification received from firebase.

                  这就是我从 firebase 向我的应用发送通知的方式 Blogpost链接.

                  This is how I am sending notification from firebase to my app Blogpost link.

                  如何在您的 Android 应用程序中添加 firebase

                  推荐答案

                  在通知的通知载荷中有一个声音键.

                  In the notification payload of the notification there is a sound key.

                  从官方文档看它的用途是:

                  From the official documentation its use is:

                  表示设备收到通知时要播放的声音.支持默认或捆绑的声音资源的文件名应用程序.声音文件必须位于/res/raw/.

                  Indicates a sound to play when the device receives a notification. Supports default or the filename of a sound resource bundled in the app. Sound files must reside in /res/raw/.

                  例如:

                  {
                      "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
                  
                      "notification" : {
                        "body" : "great match!",
                        "title" : "Portugal vs. Denmark",
                        "icon" : "myicon",
                        "sound" : "mySound"
                      }
                    }
                  

                  如果你想使用设备的默认声音,你应该使用:"sound": "default".

                  If you want to use default sound of the device, you should use: "sound": "default".

                  请参阅此链接以获取有效负载中所有可能的键:https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

                  See this link for all possible keys in the payloads: https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

                  对于那些不知道 Firebase 在应用处于后台时以不同方式处理通知的用户.在这种情况下,不会调用 onMessageReceived 函数.

                  For those who don't know firebase handles notifications differently when the app is in background. In this case the onMessageReceived function is not called.

                  当您的应用处于后台时,Android 会发送通知消息到系统托盘.用户点击通知会打开默认情况下应用启动器.这包括同时包含通知和数据有效载荷.在这些情况下,通知是传送到设备的系统托盘,并且数据有效负载是在您的启动器 Activity 的意图的附加内容中交付.

                  When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the app launcher by default. This includes messages that contain both notification and data payload. In these cases, the notification is delivered to the device's system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.

                  这篇关于从android中的firebase发送通知时没有通知声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在单击推送通知时打开特定屏幕以进行颤动 下一篇:Android:订阅 Firebase Cloud Messaging(FCM) 主题

                  相关文章

                • <i id='97RMQ'><tr id='97RMQ'><dt id='97RMQ'><q id='97RMQ'><span id='97RMQ'><b id='97RMQ'><form id='97RMQ'><ins id='97RMQ'></ins><ul id='97RMQ'></ul><sub id='97RMQ'></sub></form><legend id='97RMQ'></legend><bdo id='97RMQ'><pre id='97RMQ'><center id='97RMQ'></center></pre></bdo></b><th id='97RMQ'></th></span></q></dt></tr></i><div id='97RMQ'><tfoot id='97RMQ'></tfoot><dl id='97RMQ'><fieldset id='97RMQ'></fieldset></dl></div>
                  1. <small id='97RMQ'></small><noframes id='97RMQ'>

                      <legend id='97RMQ'><style id='97RMQ'><dir id='97RMQ'><q id='97RMQ'></q></dir></style></legend>
                        <bdo id='97RMQ'></bdo><ul id='97RMQ'></ul>

                    1. <tfoot id='97RMQ'></tfoot>