# Class GoogleConnect

java.lang.Object
com.codename1.social.Login
com.codename1.social.GoogleConnect

public class GoogleConnect extends Login

The GoogleConnect Login class allows the sign in with google functionality. The GoogleConnect requires to create a corresponding google cloud project. To enable the GoogleConnect to sign-in on the Simulator create a corresponding web login - https://developers.google.com/+/web/signin/

To enable the GoogleConnect to sign-in on Android Follow step 1 from here - https://developers.google.com/+/mobile/android/getting-started

To enable the GoogleConnect to sign-in on iOS follow step 1 from here - https://developers.google.com/+/mobile/ios/getting-started

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Oauth2`
  `createOauth2()`
  Creates the oauth2 to be used to login in case no native login is available for this service.
  `static GoogleConnect`
  `getInstance()`
  Gets the GoogleConnect singleton instance .
  `boolean`
  `isNativeLoginSupported()`
  Returns true if this service supports native login.
  `protected boolean`
  `validateToken(String token)`
  Returns true if the previous granted access token is still valid otherwise false.

  ### Methods inherited from class Login

  `addScopes, connect, doLogin, doLogin, doLogout, getAccessToken, isPreferRedirectPrompt, isUserLoggedIn, nativeIsLoggedIn, nativelogin, nativeLogout, setAccessToken, setCallback, setClientId, setClientSecret, setOauth2URL, setPreferRedirectPrompt, setRedirectURI, setScope, validateToken`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    public static GoogleConnect getInstance()

    Gets the GoogleConnect singleton instance .

    ###### Returns

    the GoogleConnect instance

  - ### isNativeLoginSupported

    public boolean isNativeLoginSupported()
    Description copied from class: `Login`

    Returns true if this service supports native login. If implementation returns true here, the nativelogin, nativelogout, nativeIsLoggedIn should be implemented

    ###### Returns

    true if the service supports native login

    Specified by:
      `isNativeLoginSupported` in class `Login`

  - ### createOauth2

    protected Oauth2 createOauth2()
    Description copied from class: `Login`

    Creates the oauth2 to be used to login in case no native login is available for this service.

    ###### Returns

    Overrides:
      `createOauth2` in class `Login`
    Returns:
      the Oauth2 to be used to login if no native login available and on the simulator

  - ### validateToken

    protected boolean validateToken(String token)
    Description copied from class: `Login`

    Returns true if the previous granted access token is still valid otherwise false.

    ###### Parameters

    - `token`: the access token to check

    ###### Returns

    true of the token is valid

    Specified by:
      `validateToken` in class `Login`