0.0.4 • Published 4 years ago

cordova-plugin-call-log2 v0.0.4

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
4 years ago

npm version

cordova-plugin-call-log2

Cordova plugin to access the call history on a device.

Platforms

  • Android.
  • iOS (TODO)

Installation

cordova plugins add cordova-plugin-call-log2

Usage

Listing all the call logs

// days is how many days back to go
const days = 7;

cordova.plugins.callLog.list(days, function (response) {
    console.log(response.rows);
}, function (error) {
    console.error(error)
});

Here the response.rows will be something like:

[
    {
        date: 1590644153980,
        number: "9876543210",
        type: 2,
        duration: 16,
        new: 1,
        cachedNumberType: 0,
        cachedNumberLabel: 0
    }
]

Where type is-

  • 1 === Incoming Call
  • 2 === Outgoing Call
  • 3 === Missed Call
  • 4 === Unknown

Contact a phone number

cordova.plugins.callLog.contact("+919876543210", function (response) {
    console.log(response);
}, function (error) {
    console.error(error)
});

Show a phone number

cordova.plugins.callLog.show("+919876543210", function (response) {
    console.log(response);
}, function (error) {
    console.error(error)
});

Delete a call log

cordova.plugins.callLog.delete("+919876543210", function (response) {
    console.log(response);
}, function (error) {
    console.error(error)
});