如何获得谷歌联系人电子邮件和电话号码ionic,cordova与$ cordovaOauth?

时间:2017-03-08 06:17:32

标签: javascript angularjs cordova ionic-framework google-contacts

我需要帮助才能获得谷歌联系方式电子邮件,电话号码为ion,cordova with $cordovaOauth

1 个答案:

答案 0 :(得分:1)

在谷歌控制台api中创建谷歌oauth api,如'1234567890-qhjnn7du9jrnhchuu66cc08i7pbuaaod.apps.googleusercontent.com'

$scope.googleinvite = function() {

    $cordovaOauth.google("1234567890-qhjnn7du9jrnhchuu66cc08i7pbuaaod.apps.googleusercontent.com", ["https://www.google.com/m8/feeds"]).then(function(result) {
            console.log(result)
            var googleaccount = $http({
                method: 'GET',
                url: 'https://www.google.com/m8/feeds/contacts/default/full?access_token=' + result.access_token + "&alt=json&max-results=5000",
                dataType: "jsonp",
            });
            googleaccount.success(function(response) {
                console.log(response);
            });
        },
        function(error) {
            console.log("Error -> " + error);
        });
}