I want to access recent call logs using Cordova but there is no official plugin for that, some guy made a custom plugin for that https://github.com/dalyc/Cordova-CallLog-Plugin is the only hope for me, but the problem is this plugin is no longer supported by its creator and it is using AngularJS in his example. I did my search work and found that People tried to use this plugin to use with javascript but they got no working solution. As the author mentioned here https://github.com/dalyc/Cordova-CallLog-Plugin/issues/4 there are 3 functions that will work with javascript.
window.plugins.calllog.list : get recent calls - takes a day limit e.g 7 is go back a week
window.plugins.calllog.show : show contact for specified phone number
window.plugins.calllog.contact : get contact details for specified phone number
I tried each of them and apparently window.plugins.calllog.show is working fine and it is showing contact for specific numbers. But window.plugins.calllog.list did not worked for me it is returning "undefined". Need help please. Thanks in advance.
my index.html contains
<button id="call_log" onclick="loadLogs();">call log</button>
my app.js contains
//calllog
function loadLogs() {
if(window.plugins.calllog == "undefined"){
alert("Doesn't works");
}
else
{
alert("works");
window.plugins.calllog.show('12345');
//this code is working and opening list of contacts having these "12345" in their phonenumber
var list = window.plugins.calllog.list('7');
alert(list[0]);
}
}
Uncaught TypeError: Cannot read property '0' of undefined
Here is a plugin I have made
https://www.npmjs.com/package/callsplugin
you basically have to write the command
cordova plugin add callsplugin
and follow the instruction you find in the project site