更新记录
1.1.4(2025-09-09)
优化短信获取内容为空问题
1.1.3(2025-07-04)
优化
1.1.2(2025-04-10)
增加清除所有通知
查看更多平台兼容性
uni-app(4.07)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | √ | √ | 5.0 | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x(4.07)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | - | - | - |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
√ | √ | √ |
android-notiation
长期维护,有任何问题在插件群联系
插件测试使用方法
-
选择试用,绑定要试用的项目appid,
-
选择后下载到对应的本地项目,
-
按照文档 -》把插件引入项目(即 import {NotifationListener} from "@/uni_modules/android-notiation" 需要先引入),
-
发布-》云打包-》选择制作基座-》打包等基座制作完成
-
运行 -》 运行到手机或模拟器-》运行到Androidapp基座-》选择使用自定义基座运行-》选择手机-》运行
-
若之前手机安装过基座需要先卸载之前的基座
推荐作者保活插件一起使用
uniapp
import {NotifationListener} from "@/uni_modules/android-notiation"
var listener=new NotifationListener();
listener.setMessageListener();
listener.listenerMessage(function( pkg, title, msg){
// showToast(pkg+"\n"+title+"\n"+msg)
that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
listener.listenerMessageState(function(state){
})
listener.listenerRemoveMessage(function( pkg, title, msg){
})
listener.openListener();
uniappx
import {NotifationListener} from "@/uni_modules/android-notiation"
var listener:NotifationListener|null=null;
listener=new NotifationListener();
listener?.setMessageListener();
var that=this;
listener?.listenerMessage(function( pkg:string, title:string, msg:string){
// showToast(pkg+"\n"+title+"\n"+msg)
that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
listener?.listenerMessageState(function(state:boolean){
showToast(state.toString()+"")
})
listener?.listenerRemoveMessage(function( pkg:string, title:string, msg:string){
// showToast(pkg+"\n"+title+"\n"+msg)
// that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
listener?.openListener();
NotifationListener 对象
api
是否开启通知权限
isNotifationListener
return boolean
var b=listener.isNotifationListener();
打开通知设置
openNotifationSetting
listener.openNotifationSetting()
收通知栏消息
openListener
listener.openListener();
关闭接收通知栏消息
closeListener
listener.closeListener();
接收通知栏消息
listenerMessage
参数1 方法function 参数1 string 参数2 string 参数3 string uniappx
listener?.listenerMessage(function( pkg:string, title:string, msg:string){
// showToast(pkg+"\n"+title+"\n"+msg)
that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
uniapp
listener.listenerMessage(function( pkg, title, msg){
// showToast(pkg+"\n"+title+"\n"+msg)
that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
移除通知栏消息时调用
listenerRemoveMessage
参数1 方法function 参数1 string 参数2 string 参数3 string uniappx
listener.listenerRemoveMessage(function( pkg:string, title:string, msg:string){
// showToast(pkg+"\n"+title+"\n"+msg)
// that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
uniapp
listener.listenerRemoveMessage(function( pkg, title, msg){
// showToast(pkg+"\n"+title+"\n"+msg)
// that.msg="包名:"+pkg+"\n"+"标题:"+title+"\n内容:"+msg;
})
移除所有通知
listener.cancelAll();