mGoogleSignInClient = GoogleSignIn.getClient(this, new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN) .requestScopes(Drive.SCOPE_APPFOLDER) .build()); mAsyncQueryHandler = new AsyncQueryHandler(getContentResolver()) {
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mLoginAction = args.getInt(LoginActivity.EXTRA_ACTION); } GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestScopes(new Scope(WALLET_SCOPE)) .build(); mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .enableAutoManage(getActivity(), this) .addConnectionCallbacks(this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); }
.requestEmail() .requestServerAuthCode(clientId, true) .requestScopes(new Scope(Scopes.DRIVE_FILE)) .build();
.requestScopes(Drive.SCOPE_FILE) .requestScopes(Drive.SCOPE_APPFOLDER); if (mConflictedCompletionEvent.getAccountName() != null) { signInOptionsBuilder.setAccountName(mConflictedCompletionEvent.getAccountName());
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(new Scope(Scopes.DRIVE_APPFOLDER)) .requestIdToken("847235219484-rc4h5v8krng4v33trnhq744sjqfntg3a.apps.googleusercontent.com") .requestEmail() .build(); mAuth = FirebaseAuth.getInstance(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, null) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if (user != null) { // User is signed in Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid()); } else { // User is signed out Log.d(TAG, "onAuthStateChanged:signed_out"); } } }; }
public void downloadinit() { GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(Drive.SCOPE_FILE, Drive.SCOPE_APPFOLDER) .requestIdToken("YOUR_REQUEST_ID_TOKEN") .build(); mGoogleSignInClient = GoogleSignIn.getClient(getContext(), signInOptions); Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN_DOWNLOAD); }
/** * Starts the sign-in process and initializes the Drive client. */ private void signIn() { GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(Drive.SCOPE_FILE) .requestScopes(Drive.SCOPE_APPFOLDER) .build(); GoogleSignInClient googleSignInClient = GoogleSignIn.getClient(this, signInOptions); startActivityForResult(googleSignInClient.getSignInIntent(), REQUEST_CODE_SIGN_IN); }
public void backuptodrive(String path) { GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(Drive.SCOPE_FILE, Drive.SCOPE_APPFOLDER) .requestIdToken("YOUR_REQUEST_ID_TOKEN") .build(); mGoogleSignInClient = GoogleSignIn.getClient(getContext(), signInOptions); Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); tmppath = path; }