更新记录

1.0.0(2024-04-19)

发布插件


平台兼容性

Android Android CPU类型 iOS
适用版本区间:6.0 - 14.0 armeabi-v7a:支持,arm64-v8a:支持,x86:未测试 ×

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


概述

  • 支持权限申请和检查
  • 支持后台服务监听通话状态实时回调通话录音文件信息
  • 支持获取系统通话记录
  • 支持获取和删除录音记录
  • 支持用户主动设置录音文件检索路径
  • 支持默认设置录音文件检索路径
  • 支持主动获取指定路径下的录音文件列表
  • 支持删除文件
  • 支持检查电话录音设置和打开电话录音设置
  • 支持android11以上打开所有文件权限

    温馨提示 如何调用插件

    const plugin = uni.requireNativePlugin('uniplugin-CallInterceptAudio');  
    var globalEvent = uni.requireNativePlugin('globalEvent');

通话录音回调

onLoad() {
            //通话录音结束监听回调
            const _this = this;
            globalEvent.addEventListener('recordAudioCallBack', function(e) {
                //这里会回调手机号,录音文件路径,通话类型 1:主动拨电话 0:接听电话
                _this.result = JSON.stringify(e); 

                // 调用接口getCallRecordAudio查询录音文件->业务根据返回的路径上传->
                // -->上传成功后执行删除调用接口delCallRecordAudio(这里是删除本地数据缓存,若需要删除音频文件可使用uniapp提供的文件删除接口进行删除)
                // plugin.getCallRecordAudio({},
                //  (ret) => {
                //      _this.result = JSON.stringify(ret);
                //  })
            });
        },

检查权限

               const _this = this;
                plugin.checkPermissions({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

申请权限

        const _this = this;
                plugin.applyPermissions({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

android11以上打开所有文件权限

                const _this = this;
                plugin.openExternalStorageSetting((ret) => {
                        _this.result = JSON.stringify(ret);
                    })

检查通话录音设置

                const _this = this;
                plugin.checkOpenRecord({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

打开通话录音设置

            const _this = this;
                plugin.openRecord({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

启动通话监听后台服务,实时回调录音文件

        const _this = this;
                plugin.startRecordAudioService({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

停止通话监听后台服务

                const _this = this;
                plugin.stopRecordAudioService({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取通话记录

            const _this = this;
                plugin.getCallPhoneLog({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取通话录音记录

                const _this = this;
                plugin.getCallRecordAudio({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

删除通话录音记录

                const _this = this;
                plugin.delCallRecordAudio({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

用户主动设置录音路径

             const _this = this;
              plugin.setRecordAudioPath({
                        recordFilePath: _this.recordPath,
                    },
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取用户主动设置的录音路径

              const _this = this;
                plugin.getRecordAudioPath({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

默认设置录音路径数组

            const _this = this;
                var path = Array();
                path.push("/sdcard/Record/Call")
                path.push("/sdcard/Music/Recordings/Call Recordings")

                plugin.setRecordAudioPathArray({
                        recordFilePath: path,
                    },
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取默认设置录音路径数组

                const _this = this;
                plugin.getRecordAudioPathArray({},
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取最新的通话录音文件

               const _this = this;
                plugin.getLatestRecordAudioFile({
                        limit: '10', //获取最多条数
                        fileDir: '/sdcard/Music/Recordings/Call Recordings'
                    },
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

获取系统信息

               const _this = this;
                plugin.getSystemInfo({
                    },
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

删除文件

            const _this = this;
                plugin.delFile({
                        filePath: '录音文件路径'
                    },
                    (ret) => {
                        _this.result = JSON.stringify(ret);
                    })

隐私、权限声明

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

android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_EXTERNAL_STORAGE android.permission.READ_CALL_LOG android.permission.READ_PHONE_STATE

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

插件不采集任何数据

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

暂无用户评论。

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