Monday, June 29, 2015

Fb vs G+ android sdk

Recently I had an opportunity to implement facebook and google plus login into android application. So i decided to write a small comparison of those two (fb v4.3, google services v4.3.23)

Google plus

  • server side setup required (create new app)
  • adding generated key into android manifest
  • implementation consists of a few methods, activity implements ConnectionCallbacks and OnConnectionFailedListener

Facebook

  • server side setup required (create new app)
  • adding generated key into android manifest, and declaration of one activity
  • sdk is not compatible with eclipse (there can be found an easy workaround on stackoverflow)
  • xml customization of fb button can be done only by overwriting styles in Fb SDK (which is not a recommended solution)
  • implementation consists of only a few lines of code (initialization, button listener, onActivityResult)
  • if user enters invalid fingerprint of debug/release key, the error shows value of your key (very helpful)

Conclusion

Apart from two fb drawbacks I have to admit their documentation is really helpful. Both tutorials have the initialization process split into few short articles but I was stuck for about a half day with g+ implementation. I wasn't able to revoke user's already granted access. Finally I found out (on stackoverflow) that I missed one line which was not in main documentation.

       
/* Client used to interact with Google APIs. */
mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
     //use 
    .addApi(Plus.API, Plus.PlusOptions.builder().build())
     //instead of 
     //addApi(Plus.API)
    .addScope(Scopes.PLUS_LOGIN)
    .addScope(Scopes.PLUS_ME)
    .build();
Share: