开发者社区> 问答> 正文

在应用研发平台EMAS上移动推送可以自定义设置音效吗?

在应用研发平台EMAS上移动推送可以自定义设置音效吗?

展开
收起
小小鹿鹿鹿 2023-11-06 16:22:23 45 0
2 条回答
写回答
取消 提交回答
  • 在线可以,离线不行。此回答来自钉群应用研发平台EMAS开发者交流群。

    2023-11-07 22:43:54
    赞同 展开评论 打赏
  • 可以,设置通知声音
    设置推送通知声音文件路径。注意android 8.0以上需要使用NotificationChannel配置声音。https://help.aliyun.com/document_detail/434666.html?spm=a2c4g.435761.0.i7


    若不调用本接口,默认获取资源ID为R.raw.alicloud_notification_sound的资源文件。

    若没有获取到指定声音文件,取设备设置的消息声音。

    接口定义

    void setNotificationSoundFilePath(String filePath);

    ``` int assignSoundId = getResources().getIdentifier(ASSIGN_NOTIFCE_SOUND, DEFAULT_RES_SOUND_TYPE, PackageName);
    if (assignSoundId != 0) {
    String defaultSoundPath = DEFAULT_RES_PATH_FREFIX + getPackageName() + "/" + assignSoundId;
    mPushService = PushServiceFactory.getCloudPushService();
    mPushService.setNotificationSoundFilePath(defaultSoundPath);
    Log.i(SETTING_NOTICE, "Set notification sound res id to R." + DEFAULT_RES_SOUND_TYPE + "." + ASSIGN_NOTIFCE_SOUND);
    this.appendConsoleText("Set notification sound res id to R." + DEFAULT_RES_SOUND_TYPE + "." + ASSIGN_NOTIFCE_SOUND);
    } else {
    Log.e(SETTING_NOTICE, "Set notification sound path error, R."

                    + DEFAULT_RES_SOUND_TYPE + "." + ASSIGN_NOTIFCE_SOUND + " not found.");
            this.appendConsoleText("Set notification sound path error, R."
                    + DEFAULT_RES_SOUND_TYPE + "." + ASSIGN_NOTIFCE_SOUND + " not found.");
        }
    

    ```

    2023-11-06 16:55:47
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
基于阿里巴巴以及合作伙伴的最佳实践,围绕大前端、云原生领域的相关技术热点(小程序、Serverless、应用中间件、低代码、DevOps)展开行业探讨,与开发者一起探寻云原生时代应用研发的新范式。
相关文档: 移动研发平台
问答排行榜
最热
最新

相关电子书

更多
五天玩转EMAS Serverless 立即下载
EMAS平台全景介绍 立即下载
低代码开发师(初级)实战教程 立即下载