Class GoogleSignInService
- java.lang.Object
-
- edu.cnm.deepdive.scalescroller.service.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Task<GoogleSignInAccount>
completeSignIn(Intent data)
Completes the signin process and sets the account.GoogleSignInAccount
getAccount()
Returns the current Google Sign In account.static GoogleSignInService
getInstance()
Returns an instance of the singleton GoogleSignInService.Single<GoogleSignInAccount>
refresh()
Refreshes the signin with Google.static void
setContext(Application context)
Sets the application context for the class.Task<Void>
signOut()
Signs the user out.void
startSignIn(Activity activity, int requestCode)
Allows the activity to start a signin request.
-
-
-
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 aGoogleSignInAccount
.
-
-