更新记录
1.0.3(2024-07-17)
优化
1.0.2(2024-06-28)
优化
1.0.1(2024-04-26)
优化
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.6.8,Android:支持,iOS:不确定,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
鸿蒙元服务 |
× |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
jk-push
开发文档
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<text class="tips">注意:uts组件插件需要使用自定义基座才能生效!</text>
<button @click="initPush">初始化推送资源</button>
<button @click="resumePush">初始化push</button>
<button @click="startPush">启动push</button>
<button @click="stopPush">停止push</button>
<button @click="getPushClientId">获取PushClientId</button>
</view>
</template>
<script>
import * as JkPush from "@/uni_modules/jk-push";
import { RegAppInfo } from "@/uni_modules/jk-push";
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
//启动监听推送消息事件
JkPush.onPushMessage((res)=>{
console.log("onPushMessage",res)
})
},
onUnload() {
//关闭推送消息监听事件
JkPush.offPushMessage()
},
methods: {
initPush() {
let appInfo : RegAppInfo = {
xiaomi_appId: '开发者平台appId',
xiaomi_appKey: '开发者平台appKey'
}
JkPush.initPush(appInfo)
},
resumePush() {
JkPush.resumePush()
},
startPush() {
//开启推送
JkPush.startPush()
},
stopPush() {
//停止推送
JkPush.stopPush()
},
getPushClientId() {
console.log("获取推送标识",JkPush.getPushClientId())
},
}
}
</script>
<style>
.content {
display: flex;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-bottom: 50rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>