使用 CodeNameOne 推送通知声音

问题描述 投票:0回答:1

我尝试在手机收到推送通知时播放默认系统声音。

这是我使用的查询:

String query = "token="+ "token" +
                        "&device="+ session.getPushKey()+
                        "&type="+ notification.getType() +
                        "&auth="+ "auth" +
                        "&certPassword="+ "certPass"+
                        "&cert="+ "cert"+
                        "&body="+ notification.getBody() +
                        "&production="+ "true"+
                        "&sound=default";

我的手机(三星S20)收到推送通知,但没有声音,也没有振动。 该应用程序没有静音,手机也是如此。我用朋友的手机试过,但结果是一样的。

我错过了什么吗?

顺便说一句,有没有办法播放自定义声音? 我在网上搜索时发现 .wav 文件可以工作,需要放在此处“/android/raw/bellbox.wav”。但由于手机不播放声音和振动,我无法确定这一点。这是正确的道路吗?

谢谢

push-notification codenameone
1个回答
0
投票

确保应用程序中有以下构建提示:

android.NotificationChannel.importance=4
android.newFirebaseMessaging=true

请注意,如果您直接将它们包含在设置中,则需要以

codename1.arg.
为前缀。如果这不能解决问题,请使用
android.*
构建提示的详细信息以及失败的 Android 版本来编辑您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.