小编Sun*_*ash的帖子

cordova中的CallLog访问插件无法正常工作

嗨,我正在使用cordova开发混合应用程序.我试图使用CallLog插件访问在Android手机中错过的最后一个电话.这是我试过的,

1.I installed the plugin with this command cordova plugin add https://github.com/dalyc/Cordova-CallLog-Plugin.git.
2.I am using angularJS.I have this app.js.

var app=angular.module('lmp', ['ngCordova']);
     app.controller('lmpctrl',['$scope', 'CallLogService', function($scope, CallLogService){
        $scope.data = {};
                $scope.callTypeDisplay = function(type) {
                    switch(type) {
                        case 1:
                            return 'Incoming';
                        case 2:
                            return 'Outgoing';
                        case 3:
                            return 'Missed';
                        default:
                            return 'Unknown';
                    }};

                CallLogService.list(1).then(
                    function(callLog) {
                        console.log(callLog);
                        $scope.data.lastCall = callLog[0];
                    },
                    function(error) {
                        console.error(error);
                    });
            }]);

     app.factory('CallLogService', ['$q', function($q) {
            return {
                list : function(days) {
                    var q = $q.defer();
                    // days …
Run Code Online (Sandbox Code Playgroud)

android angularjs cordova

10
推荐指数
1
解决办法
342
查看次数

标签 统计

android ×1

angularjs ×1

cordova ×1