开发者社区> 问答> 正文

应用研发平台EMAS按照官方rn的插件方法集成进去,想在收到离线消息的时候播报一段语音,应该如何实现

有实现Receiver,没有集成AndroidPopupActivity;
服务端推送的时候AndroidPopupActivity用的是MainActivity,能收到离线通知,但不清楚怎么在收到离线消息的时候播报一段自定义音频,请教下应该如何实现?

public class MyMessageReceiver extends AliyunPushMessageReceiver {
    // 消息接收部分的LOG_TAG
    public static final String REC_TAG = "receiver";
    @Override
    public void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
        // TODO处理推送通知
        Log.e("MyMessageReceiver", "Receive notification, title: " + title + ", summary: " + summary + ", extraMap: " + extraMap);
    }
    @Override
    public void onMessage(Context context, CPushMessage cPushMessage) {
        Log.e("MyMessageReceiver", "onMessage, messageId: " + cPushMessage.getMessageId() + ", title: " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
    }
    @Override
    public void onNotificationOpened(Context context, String title, String summary, String extraMap) {
        Log.e("MyMessageReceiver", "onNotificationOpened, title: " + title + ", summary: " + summary + ", extraMap:" + extraMap);
    }
    @Override
    protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
        Log.e("MyMessageReceiver", "onNotificationClickedWithNoAction, title: " + title + ", summary: " + summary + ", extraMap:" + extraMap);
    }
    @Override
    protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
        Log.e("MyMessageReceiver", "onNotificationReceivedInApp, title: " + title + ", summary: " + summary + ", extraMap:" + extraMap + ", openType:" + openType + ", openActivity:" + openActivity + ", openUrl:" + openUrl);
    }
    @Override
    public void onNotificationRemoved(Context context, String messageId) {
        Log.e("MyMessageReceiver", "onNotificationRemoved");
    }
}

展开
收起
1643007912557286 2024-10-22 14:57:43 31 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
生态与兼容MaxCompute大数据生态集成和开发工具 立即下载
核心: 线下支付技术集成关键点 立即下载
阿里邮箱—安全高效集成 立即下载