uniapp自定义消息语音

需求是后端推送的消息APP要响自定义语音,利用官方插件,总结下整体流程

uniapp后台配置

因为2.0只支持uniapp自己的后台发送消息,所以要自己的后台发送消息只能用1.0

插件地址和代码

插件地址: link

javascript 复制代码
let isIos = (plus.os.name == "iOS");
	if (isIos) {
		setCustomPushChannel({
			soundName: 'ceshi',
			channelId: 'ceshi',
			channelDesc: 'ceshi',
			enableLights: true,
			enableVibration: true,
			importance: 4,
			lockscreenVisibility: 1
		});
	} else {
		const plugin = uni.requireNativePlugin("DCloud-PushSound");
		setTimeout(() => {
			plugin.setCustomPushChannel({
				soundName: 'ceshi',
				channelId: 'ceshi',
				channelDesc: 'ceshi',
				enableLights: true,
				enableVibration: true,
				importance: 4,
				lockscreenVisibility: 1
			});
		}, 500)
	}
相关推荐
DK185838322527 小时前
【源码开源部署】电竞代练护航陪玩小程序:全游戏服务平台完整解决方案(附宝塔部署教程)
游戏·微信小程序·uni-app·开源·php
码云数智-大飞7 小时前
2026 年跨端开发决战:小程序原生 vs uni-app vs Taro 深度对比
小程序·uni-app·taro
BS30813_vx13 小时前
基于 Express + uni-app 的养老院管理系统设计与实现
后端·uni-app·express
bug总结16 小时前
uniapp 微信小程序请求规范
微信小程序·小程序·uni-app
梦曦i2 天前
unix-router v0.1.0 首发:uni-app x 的 vue-router 风格路由库
前端·uni-app
bug总结2 天前
uniapp 微信小程序分包规范
微信小程序·小程序·uni-app
天府云创2 天前
uni-app X 蒸汽模式发布!性能比肩原生~
前端框架·uni-app·移动开发·原生应用·蒸汽模式·app研发·多端适配
堕落年代3 天前
uni-app x 蒸汽模式:实时流式语音识别(ASR)三大疑难杂症全记录
人工智能·uni-app·语音识别
RisunJan3 天前
uni-app 高频面试题与解答
uni-app
梦曦i3 天前
@meng-xi/create-uni-app vs unibest:轻量脚手架与重型框架的定位之争
前端·uni-app