更新记录

1.1.2(2025-04-10)

增加清除所有通知

1.1.1(2025-04-05)

优化

1.1.0(2025-02-28)

修改源码付费

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.8,Android:4.4,iOS:不支持,HarmonyNext:不确定 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序 鸿蒙元服务
× × × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

android-notiation

长期维护,有任何问题在插件群联系

推荐作者保活插件一起使用

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();

隐私、权限声明

1. 本插件需要申请的系统权限列表:

<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" tools:ignore="ProtectedPermissions" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问