Skip to content

开启前台通知服务

方法名

startForeground

注意

这个功能一般是手机锁屏后应用能接收到插件返回的数据

用法

  • 用法如下:

    js
    module.startForeground({
      //前台通知服务标题
      title: "安卓电话通话监听原生插件",
      //前台通知服务内容
      content: "安卓电话通话监听原生插件正在运行中",
      //icon图标名称,不需要加后缀名,需放置到【uni_modules】>【leven-uts-call】> 【utssdk】> 【app-android】> 【res】> 【mipmap】>图片名称
      icon: "icon"
    }, res => {
      this.writeLog(JSON.stringify(res))
    });
  • 参数说明

    参数名参数类型是否必填默认值参数描述
    titleString前台通知标题
    contentString前台通知描述
    iconString前台通知图标

    注意

    前台通知图标,不需要加后缀名,需放置到【uni_modules】>【leven-uts-call】> 【utssdk】> 【app-android】> 【res】> 【mipmap】>图片名称

回调

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