From 51c8e2ebc2da6b127a4224dcf527fdf3beb24d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Sun, 18 Sep 2022 21:48:20 +0200 Subject: [PATCH] Update README.md --- README.md | 64 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c4944d7..f6d1cff 100644 --- a/README.md +++ b/README.md @@ -17,27 +17,31 @@ Cordova plugin to access the call history on a device. Results can be filtered t First of all you must check / request permissions with - window.plugins.callLog.hasReadPermission(...,...) - window.plugins.callLog.requestReadPermission(...,...) +```javascript +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 - }); +```javascript +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 @@ -54,11 +58,13 @@ This will return all calls from/to the number +32477000000 since 2018-01-30 Here is an example with the operator like - let filters = [{ - "name": "number", - "value": "+32%", - "operator": "like", - }] +```javascript +let filters = [{ + "name": "number", + "value": "+32%", + "operator": "like", +}] +``` This will return all calls from/to the numbers beginning with '+32' @@ -66,11 +72,13 @@ 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": "==", - }] +```javascript +let filters = [{ + "name": "number", + "value": ["+32477000000", "+32478000000"], + "operator": "==", +}] +``` This will return all calls from/to the numbers +32477000000 and +32478000000