更新记录
2.8.0(2025-11-24)
下载此版本
首次发布,详细请查看 ZEGO 官网。
平台兼容性
uni-app(4.27)
| Vue2 |
Vue2插件版本 |
Vue3 |
Vue2插件版本 |
Chrome |
Safari |
app-vue |
app-vue插件版本 |
app-nvue |
app-nvue插件版本 |
Android |
Android插件版本 |
iOS |
iOS插件版本 |
鸿蒙 |
| √ |
2.8.0 |
√ |
2.8.0 |
× |
× |
√ |
2.8.0 |
√ |
2.8.0 |
6.0 |
2.8.0 |
12 |
2.8.0 |
× |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| × |
× |
× |
× |
× |
× |
× |
× |
× |
× |
× |
uni-app x(4.27)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| - |
- |
- |
- |
- |
- |
其他
zego-zpns-uts
开发文档
Native App 开发
使用 SDK
// <script>
import { ZPNs, ZPNsConfig, ZPNsRegisterConfig, ZPNsNotificationChannel, ZPNsLocalMessage } from '@/uni_modules/zego-zpns-uts';
export default {
onLaunch() {
// #ifdef APP-IOS
// iOS 平台需要使用 推送模块
// UTS 项目由于官网摇树优化,需要调用推送接口才能注册推送模块
uni.getPushClientId({});
// #endif
},
onShow() {
this.useZPNs();
},
methods: {
useZPNs() {
// 设置为第1套证书,如果有多套证书时(多个App间互相推送)填写对应的序号
const appType = 1;
// Google FCM 和 国内厂商需要区分开,分别打包
// Google FCM 配置
let appConfig: ZPNsConfig = { appType, enableFCMPush: false };
// ZPNs.setPushConfig(appConfig);
// 国内厂商 配置
appConfig: ZPNsConfig = {
appType,
// 填写在各厂商推送管理平台注册的App的信息
enableHWPush: true, hwAppID: '',
enableMiPush: true, miAppID: '', miAppKey: '',
enableOppoPush: true, oppoAppID: '', oppoAppKey: '', oppoAppSecret: '',
enableVivoPush: true, vivoAppID: '', vivoAppKey: '',
};
ZPNs.setPushConfig(appConfig);
const zpns = ZPNs.getInstance();
// 注册回调事件
zpns.onRegistered((res) => console.log(JSON.stringify(res)));
zpns.onNotificationArrived((res) => console.log(JSON.stringify(res)));
zpns.onNotificationClicked((res) => console.log(JSON.stringify(res)));
zpns.onThroughMessageReceived((res) => console.log(JSON.stringify(res)));
// iOS 需要申请通知权限
zpns.applyNotificationPermission();
const registerConfig: ZPNsRegisterConfig = {
androidEnvironment: 1, // 1: 开发环境, 0: 正式环境
iOSEnvironment: 1, // 1: 开发环境, 0: 正式环境
// enableIOSVoIP: true, // 是否使用 zego-callkit-uts 插件来实现 iOS VoIP 功能
iOSNotificationArrivedConfig: {
isPresentAlert: true,
isPresentBadge: true,
isPresentSound: true,
}
};
zpns.registerPush(registerConfig);
}
}
}
// </script>
参考文档