首页 文章

更改expo.sendPushNotificationsAsync中的声音

提问于
浏览
0

我想从节点服务器点击我的expo应用程序中的任何通知时播放其他声音 . 我找不到除“默认”之外的任何其他声音 . 我还可以使用其他任何声音播放除默认声音之外的其他声音关于expo中的通知 . 我的nodeJS代码如下:

const receipts = expo.sendPushNotificationsAsync([
            {
              to: userObj.pushToken,
              sound: 'default',
              body: notification,
              data: { withSome: notification },
              priority: 'high',
            },
          ]);

1 回答

  • 0

    我查了docs的Message Format部分,发现了这个:

    收件人收到此通知时播放的声音 . 指定“默认”以播放设备的默认通知声音,或省略此字段以播放声音 . 请注意,在针对Android 8.0的应用程序上(如果使用expo build,已构建
    在2018年6月或之后),此设置对Android无效 .
    相反,使用channelId和具有所需设置的通道 .
    声音?:'默认'|空值,

    看起来无法通过应用程序更改声音 .

相关问题