Skip to content

设置状态栏图标

注意

  • 若不调用本接口,默认获取R.drawable.alicloud_notification_smallicon的资源文件
  • 若没有获取到指定图标文件,取App启动图标

方法名

setNotificationSmallIcon

用法

  • 用法如下:
js
module.setNotificationSmallIcon({
  params: {
    icon: "icon",
  },
  //成功执行的函数
  success: (res) => {
    console.log(data)
  },
  //失败执行的函数
  fail: (res) => {
    console.log(res)
  },
  //接口调用完成返回函数,不管成功还是失败都会返回
  complete: (res) => {
    // console.log(res)
  }
})
js
module.setNotificationSmallIcon({
  params: {
    icon: "icon",
  },
  //成功执行的函数
  success: (res) => {
    console.log(res)
  },
  //失败执行的函数
  fail: (res) => {
    console.log(res)
  },
  //接口调用完成返回函数,不管成功还是失败都会返回
  // complete: (res) => {
  //   console.log(res)
  // }
} as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject接口请求参数
    params.iconString图标文件名,文件须放置到app-android > res > drawable目录下,如果插件中没有该目录需创建一个,icon参数无需带扩展名
    successFunction执行成功的函数
    failFunction执行失败的函数
    completeFunction执行完成的函数,不管成功还是失败都会执行

回调

  • 示例
json
{
    "data": {},
    "message": "",
    "code": 0
}
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    codeInteger返回类型,0.成功,其他:失败