更新记录
1.0.0(2025-04-07)
新发布,支持多种条件查询
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | 5.0 | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | - | - | - |
📞 getCallLog 方法文档
1. 功能概述
通过 @/uni_modules/wmm-callLog
插件的 getCallLogs
方法,实现设备通话记录查询功能。支持以下筛选条件:
- 时间范围查询
- 通话类型过滤
- 通话时长区间
- 电话号码精确匹配
2. 插件导入
2. 插件导入
使用 uni_modela 插件管理工具导入插件,或手动下载插件包并放置在项目的 uni_modules
目录下。
import { SelectParams, getCallLogs } from "@/uni_modules/wmm-callLog"
methods: {
getCallLog() {
const params = {
startTime: null, // 时间戳或null
callType: null, // 通话类型
minDuration: null, // 最短时长(秒)
maxDuration: null, // 最长时长(秒)
phoneNumber: null // 电话号码
}
const result = getCallLogs(params);
console.log(result);
}
}
3. 参数说明
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
startTime | number/null | null | 起始时间戳(毫秒),null表示无限制 |
callType | number/null | null | 1-呼入 2-呼出 3-未接 4-语音邮件 5-拒接 6-拦截 |
minDuration | number/null | null | 最短通话时长(秒) |
maxDuration | number/null | null | 最长通话时长(秒) |
phoneNumber | string/null | null | 11位手机号码 |
4. 调用示例
查询最近3天的呼出通话(时长>5秒)
const params = {
startTime: Date.now() - 259200000, // 3天(1000*60*60*24*3)
callType: 2,
minDuration: 5
};
const logs = getCallLogs(params);
5. 注意事项
⚠ 权限要求
必须已获取 READ_CALL_LOG 权限
⚠ 兼容性说明
- Android 5.0+ 支持全部通话类型
- 时间戳建议使用
Date.now()
- 不同设备厂商可能有不同限制