How to use both google+ and facebook login in same appdelegate.swift

Your application should handle facebook and google links, then return true if one or the other can handle the given link. func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { let googleDidHandle = GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation) let facebookDidHandle = FBSDKApplicationDelegate.sharedInstance().application( application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) return googleDidHandle … Read more

Android Emulator: This app won’t run without Google Play services

Ok, after trying some things it turned out I had one last option not correctly checked, which wasn’t mentioned anywhere in the tutorial(s).. Instead of Android 4.4.2 as Project Build Target & Emulator Target, I’ve selected Google APIs 4.4.2. Now I don’t get the error of Google Play services anymore. I do get a NullPointerException … Read more

Google+ API: How can I use RefreshTokens to avoid requesting access every time my app launches?

Here is an example. Make sure you add a string setting called RefreshToken and reference System.Security or find another way to safely store the refresh token. private static byte[] aditionalEntropy = { 1, 2, 3, 4, 5 }; private static IAuthorizationState GetAuthorization(NativeApplicationClient arg) { // Get the auth URL: IAuthorizationState state = new AuthorizationState(new[] { … Read more

Adding a Google +1 button in Android App

With the Google+ platform for Android, you are now able to integrate a native +1 button in your Android app. 1) You first need to initialize the PlusClient object in your Activity. 2) Include the PlusOneButton in your layout: <com.google.android.gms.plus.PlusOneButton xmlns:plus=”http://schemas.android.com/apk/lib/com.google.android.gms.plus” android:id=”@+id/plus_one_button” android:layout_width=”wrap_content” android:layout_height=”wrap_content” plus:size=”standard” plus:annotation=”inline” /> 3) Assign the PlusOneButton to a member variable … Read more

How to get user email from google plus oauth

Set your scopes to: https://www.googleapis.com/auth/userinfo.email and https://www.googleapis.com/auth/userinfo.profile And use the endpoint: https://www.googleapis.com/oauth2/v1/userinfo?alt=json Usage: get https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=youraccess_token You will get JSON: { “id”: “xx”, “name”: “xx”, “given_name”: “xx”, “family_name”: “xx”, “link”: “xx”, “picture”: “xx”, “gender”: “xx”, “locale”: “xx” }

Google Plus sharing from android app

I found the solution for sharing on google plus from android:- Steps :- 1. Generate SH1 Key by the following commands:- $keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v 2:- Create project on google api console and also create client id. https://developers.google.com/+/mobile/android/getting-started 3.Add the google play service library to project from extras.If not exist then … Read more

“Calling this from your main thread can lead to deadlock and/or ANRs while getting accesToken” from GoogleAuthUtil(Google Plus integration in Android)

Try it with an AsyncTask like this: AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void… params) { String token = null; try { token = GoogleAuthUtil.getToken( MainActivity.this, mGoogleApiClient.getAccountName(), “oauth2:” + SCOPES); } catch (IOException transientEx) { // Network or server error, try later Log.e(TAG, transientEx.toString()); } catch (UserRecoverableAuthException e) … Read more

Preventing automatic sign-in when using Google+ Sign-In

Update The best supported way to prevent automatic sign-in is to use the API method gapi.auth2.getAuthInstance().signOut() which will prevent automatic sign-in on your site after it has been called. Demo here. In the demo, the user is signed out when they leave the page as shown in the following code: window.onbeforeunload = function(e){ gapi.auth2.getAuthInstance().signOut(); }; … Read more