Class GoogleSignInService


  • public class GoogleSignInService
    extends Object
    The GoogleSignInService class provides methods that allow the app to use Google Sign In to get user information and to associate users with players in the database.
    • Method Detail

      • setContext

        public static void setContext​(Application context)
        Sets the application context for the class.
        Parameters:
        context - The application context.
      • getInstance

        public static GoogleSignInService getInstance()
        Returns an instance of the singleton GoogleSignInService.
        Returns:
        An instance of GoogleSignInService.
      • getAccount

        public GoogleSignInAccount getAccount()
        Returns the current Google Sign In account.
        Returns:
        The current account.
      • refresh

        public Single<GoogleSignInAccount> refresh()
        Refreshes the signin with Google.
        Returns:
        A Single of a GoogleSignInAccount.
      • startSignIn

        public void startSignIn​(Activity activity,
                                int requestCode)
        Allows the activity to start a signin request.
        Parameters:
        activity - The LoginActivity.
        requestCode - A code that indicates a type of request.
      • completeSignIn

        public Task<GoogleSignInAccount> completeSignIn​(Intent data)
        Completes the signin process and sets the account.
        Parameters:
        data - An intent.
        Returns:
        A Task containing a GoogleSignInAccount.
      • signOut

        public Task<Void> signOut()
        Signs the user out. If the signout is unsucessful, the account is still set to null.
        Returns:
        A Task containing Void.