Appearance
自定义通知样式
注意
- 当前插件仅支持
BasicCustomPushNotification的自定义样式,暂不支持AdvancedCustomPushNotification自定义布局文件式自定义样式
方法名
basicCustomPushNotification
用法
- 用法如下:
js
module.basicCustomPushNotification({
params: {
statusBarDrawable: "abc",
remindType:"REMIND_TYPE_VIBRATE_AND_SOUND",
notificationFlags:"FLAG_AUTO_CANCEL",
serverOptionFirst:false,
buildWhenAppInForeground:true
},
//成功执行的函数
success: (res) => {
console.log(data)
},
//失败执行的函数
fail: (res) => {
console.log(res)
},
//接口调用完成返回函数,不管成功还是失败都会返回
complete: (res) => {
// console.log(res)
}
})js
module.basicCustomPushNotification({
params: {
statusBarDrawable: "abc",
remindType:"REMIND_TYPE_VIBRATE_AND_SOUND",
notificationFlags:"FLAG_AUTO_CANCEL",
serverOptionFirst:false,
buildWhenAppInForeground:true
},
//成功执行的函数
success: (res) => {
console.log(res)
},
//失败执行的函数
fail: (res) => {
console.log(res)
},
//接口调用完成返回函数,不管成功还是失败都会返回
// complete: (res) => {
// console.log(res)
// }
} as LevenOptions)- 参数说明
参数名 参数类型 是否必填 默认值 参数描述 params Object 是 无 接口请求参数 params.statusBarDrawable String 否 无 设置自定义通知的状态栏图标,文件须放置到 app-android>res>drawable目录下,如果插件中没有该目录需创建一个,statusBarDrawable参数无需带扩展名params.remindType String 否 无 自定义通知的提醒方式,可选值如下: REMIND_TYPE_SILENT:静默REMIND_TYPE_VIBRATE:震动REMIND_TYPE_SOUND:声音REMIND_TYPE_VIBRATE_AND_SOUND:声音+震动params.notificationFlags String 否 无 支持系统自带的Notification Flag参数,可选值如下: FLAG_AUTO_CANCELFLAG_BUBBLEFLAG_INSISTENTFLAG_NO_CLEARFLAG_LOCAL_ONLYFLAG_FOREGROUND_SERVICEFLAG_GROUP_SUMMARYFLAG_ONGOING_EVENTFLAG_ONLY_ALERT_ONCEFLAG_SHOW_LIGHTSparams.serverOptionFirst Boolean 否 false 是否服务器配置优先
true:采用后端设定的提醒方式
false:采用自定义样式指定的提醒方式params.buildWhenAppInForeground Boolean 否 true 设置当推送到达时应用处在前台的情况下是否创建自定义通知 success Function 否 无 执行成功的函数 fail Function 否 无 执行失败的函数 complete Function 否 无 执行完成的函数,不管成功还是失败都会执行
回调
- 示例
json
{
"data": {
"result": true
},
"message": "",
"code": 0
}- 回调说明:
参数名 参数类型 参数描述 message String 消息提示 data Object 数据对象 data.result Boolean 操作结果 code Integer 返回类型,0.成功,其他:失败

