javascript - How to access call logs in android using Cordova? -


i want access recent call logs using cordova there no official plugin that, guy made custom plugin https://github.com/dalyc/cordova-calllog-plugin hope me, problem plugin no longer supported creator , using angularjs in example. did search work , found people tried use plugin use javascript got no working solution. author mentioned here https://github.com/dalyc/cordova-calllog-plugin/issues/4 there 3 functions work javascript.

window.plugins.calllog.list : recent calls - takes day limit e.g 7 go week window.plugins.calllog.show : show contact specified phone number window.plugins.calllog.contact : contact details specified phone number 

i tried each of them , apparently window.plugins.calllog.show working fine , showing contact specific numbers. window.plugins.calllog.list did not worked me returning "undefined". need please. 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 working , opening list of contacts having these "12345" in phonenumber                  var list = window.plugins.calllog.list('7');                 alert(list[0]);             }      } 

uncaught typeerror: cannot read property '0' of undefined

here plugin have made

https://www.npmjs.com/package/callsplugin

you have write command

cordova plugin add callsplugin 

and follow instruction find in project site


Comments