IBM工作灯5.0.5 - 玩自定义音效推送通知 [英] IBM Worklight 5.0.5 - Play custom sound on push notification
问题描述
当我使用
WL.Server.notifyAllDevices(userSubscription, {
badge: 1,
sound: "notification.wav",
activateButtonLabel: "ClickMe",
alert: notificationText,
payload: {
foo : 'bar'
}
});
推送通知IBM在Android上工作灯5.0.5,它似乎没有可以使用的自定义声音选项。无论身在何处,我把声音文件,工作灯没有找到它。根据客户端的痕迹,它甚至不搜索该文件。有没有人尝试过这种成功?
to push a notification in IBM Worklight 5.0.5 on Android, it does not seem to be possible to use the custom sound option. No matter where I put the sound file, Worklight does not find it. According to the client traces, it does not even search for the file. Has anybody ever tried this successfully?
推荐答案
要使用自定义通知声音:
To use a custom notification sound:
- 如果该文件夹不存在,添加一个名为
原
在现有的本机\ RES
文件夹中的文件夹yourProject \ APPS \ yourApp \机器人\本地
- 将在声音文件中的
原
文件夹
- If the folder does not exist already, add a folder named
raw
under the existingnative\res
folder inyourProject\apps\yourApp\android\native
- Place the sound file in the
raw
folder
当发送通知,现在要发挥您的自定义声音文件。
When sending a notification it should now play your custom sound file.
您也可以放置在 yourProject \在
;这将确保该文件将被复制到在构建您所产生的Android项目,如果你删除了原
文件夹中的声音文件APPS \ yourApp \机器人\ nativeResources \ RES 本地
文件夹中任何原因。
You can also place the sound file in a raw
folder under yourProject\apps\yourApp\android\nativeResources\res
; this will make sure the file will be copied to your generated Android project upon build, in case you have deleted the native
folder for whichever reason.
这篇关于IBM工作灯5.0.5 - 玩自定义音效推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!