java - GoogleAPIClient not connecting properly? -


i'm trying connect mgoogleapiclient, following this guide. when debug, little window popsup asking me googleplus account sign in as. select main account , click ok, stops there , absolutely nothing. no error messages, warnings, infos, no nothing.

my source: public class mainmenu_activity extends activity implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener {

    private button btnstart;     private button btnsubmit;     private button btnhof;     private googleapiclient mgoogleapiclient;     public static int request_leaderboard = 100;     // request code use when launching resolution activity     private static final int request_resolve_error = 1001;     // bool track whether app resolving error     private boolean mresolvingerror = false;     private static final string state_resolving_error = "resolving_error";      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_mainmenu);          mresolvingerror = savedinstancestate != null                 && savedinstancestate.getboolean(state_resolving_error, false);          this.mgoogleapiclient = new googleapiclient.builder(this)                 .addapi(drive.api)                 .addscope(drive.scope_file)                 .addapi(plus.api)                 .addscope(plus.scope_plus_login)                 .addscope(plus.scope_plus_profile)                 .addconnectioncallbacks(this)                 .addonconnectionfailedlistener(this)                 .build();      }      @override     protected void onstart() {         super.onstart();         if (!mresolvingerror) {  // more later             mgoogleapiclient.connect();         }     }      @override     protected void onstop() {         mgoogleapiclient.disconnect();         super.onstop();     }      @override     public void onconnected(bundle connectionhint) {         // connected google play services!         // stuff goes here.         system.out.println("connected!");     }      @override     public void onconnectionsuspended(int cause) {         // connection has been interrupted.         // disable ui components depend on google apis         // until onconnected() called.         system.out.println("suspended!");     }      @override     public void onconnectionfailed(connectionresult result) {         system.out.println("connection failed - mresolvingerror=" + mresolvingerror);         if (mresolvingerror) {             system.out.println("connection failed - attempting resolve...");             // attempting resolve error.             return;         } else if (result.hasresolution()) {             system.out.println("connection failed - resolving now...");             try {                 mresolvingerror = true;                 result.startresolutionforresult(this, request_resolve_error);             } catch (intentsender.sendintentexception e) {                 system.out.println("connection failed - exception...");                 // there error resolution intent. try again.                 mgoogleapiclient.connect();             }         } else {             // show dialog using googleplayservicesutil.geterrordialog()             dialog errdia = googleplayservicesutil.geterrordialog(result.geterrorcode(), this, 1);             errdia.show();             mresolvingerror = true;         }     }      @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {         if (requestcode == request_resolve_error) {             mresolvingerror = false;             if (resultcode == result_ok) {                 // make sure app not connected or attempting connect                 if (!mgoogleapiclient.isconnecting() &&                         !mgoogleapiclient.isconnected()) {                     mgoogleapiclient.connect();                 }             }         }     }      @override     protected void onsaveinstancestate(bundle outstate) {         super.onsaveinstancestate(outstate);         outstate.putboolean(state_resolving_error, mresolvingerror);     }   } 

as can see, tagged places follow procedure. logcat logs:

06-02 17:52:48.175 2302-2302/com.dudewithfacial.game.gamebase i/system.out﹕ connection failed - mresolvingerror=false 06-02 17:52:48.175
2302-2302/com.dudewithfacial.game.gamebase i/system.out﹕ connection failed - resolving now...

i follow guide step step :( appaently not really, doing wrong stackoverflow-gurus? thx boys, appreciated!

nvm, figured out can't use launchmode, singleuser, singleinstance. haven't configred of requested apis such ".addapi(plus.api)"

problem fixed.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -