Calling the Google API for Javascript in Ionic framework (working on web, not working on Android) -


i have log in users google, have imported google api (for javascript) in app, this:

<script src="https://apis.google.com/js/client.js?onload=onloadcallback"></script> 

the onloadcallback this:

function onloadcallback() {   try {     // set public api access key     gapi.client.setapikey(my_api_key);     gapi.client.load('plus', 'v1', function(){});   } catch (e) {     console.console.log(e);   } } 

then, have button that, upon clicking on it, triggers function singin():

var clientid = client_id web;  //web //var clientid = client_id pc;  // pc var scopes = 'https://www.googleapis.com/auth/plus.me';  $scope.signin = function() {   var config = {    'client_id': clientid,    'scope': scopes,    'immediate': false };  gapi.auth.init(function(){    gapi.auth.authorize(config,     function(){       var token = gapi.auth.gettoken();       if(!token.error){        $state.go('app.projects');       }    });  }); }; 

so try code. ionic serve , try access app mozilla firefox. , works, prompt prompted , go state.

the problem comes when ionic build android. apk generated , install in mobile, button nothing. gapi.auth.init() callback done, gapi.auth.authorize() callback never triggered.

i have api key in google's credential page, client id web browser , android client id. know android client id okay because have used different api contact google , worked on web , on android (though api lacks google+ functionality look, people retrieving thing).

i doing wrong, that's clear, don't know is. have double-checked android client id, api key android key, , have included android package name , sha1 certificate fingerprint.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -