【问题标题】:Worklight 6.1 - No Sound When Android Push Notification ArrivesWorklight 6.1 - Android 推送通知到达时没有声音
【发布时间】:2014-08-16 21:05:11
【问题描述】:

我在使用 Android 设备上的推送通知时遇到问题(在 2.2.3 和 4.x 上测试)。在 IOS 上,该应用程序运行良好,播放默认通知声音,应该是这样。 这是我用来发送通知的代码:

function submitNotification(userId, notificationText){
    var userSubscription = WL.Server.getUserNotificationSubscription('PushAdapter.PushEventSource', userId);


if (userSubscription==null){
    return { result: "No subscription found for user :: " + userId };
}

var badgeDigit = 0;

var notification = WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});

WL.Logger.debug("submitNotification >> userId :: " + userId + ", text :: " + notificationText);

WL.Server.notifyAllDevices(userSubscription, notification);

return { 
    result: "Notification sent to user :: " + userId 
};
}

我也尝试使用自定义声音;同样的结果:android 上没有声音。

【问题讨论】:

    标签: android push-notification ibm-mobilefirst


    【解决方案1】:

    你没有解释你是如何尝试设置自定义声音的,如果你能提到这一点就好了。

    同时,请参阅以下关于同一主题的问题(该部门没有任何变化,因此一般步骤仍然正确):

    如果不存在,请在 native\res 文件夹中创建名为“raw”的文件夹。将您的自定义声音文件放在那里。确保按照上面第一个问题中的说明在代码中定义它。

    【讨论】:

    • 您好伊丹,感谢您的回答。我没有解释它,因为它不是主要问题。我不想播放自定义声音;在多次尝试播放默认声音后,我只是尝试播放自定义声音。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-14
    • 2014-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-05
    相关资源
    最近更新 更多