Android only Cordova plugin to access the call history on a device. Results can be filtered through several parameters.
cordova plugin add cordova-plugin-calllog
First of all you must check / request permissions with
window.plugins.callLog.hasReadPermission(...,...)
window.plugins.callLog.requestReadPermission(...,...)
Then you can use the main function getCallLog(), here is an example:
let filters = [{
"name": "number",
"value": "+32477000000",
"operator": "==",
},
{
"name": "date",
"value": 1517266800000,
"operator": ">="
}];
window.plugins.callLog.getCallLog(filters, function(data) {
console.log(data);
}, function() {
// Error
});
This will return all calls from/to the number +32477000000 since 2018-01-30
>, >=, <, <=, ==, like
Here is an example with the operator like
let filters = [{
"name": "number",
"value": "+32%",
"operator": "like",
}]
This will return all calls from/to the numbers beginning with '+32'
Value can be a string, or can be an array, here is an example:
let filters = [{
"name": "number",
"value": ["+32477000000", "+32478000000"],
"operator": "==",
}]
This will return all calls from/to the numbers +32477000000 and +32478000000
getCallLog() returns an array of objects with these values (see https://developer.android.com/reference/android/provider/CallLog.Calls.html)
(Android API >= 21)
(Android API >= 24)
(Android API >= 21)
A contact lookup is also performed on the phone number of each log item, which adds the following values (from https://developer.android.com/reference/android/provider/ContactsContract.Data) if found
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。