Use Google Drive as a Webservice

Asked

Viewed 207 times

1

Hello.

Someone could help me, I’m trying to create an app and I’m trying to use google drive as a webservice for this app, I want to store files in my account drive (eg: audio and img) and qd the app user click a button to download a file from my drive to its cel. However qd I try to connect, the api displays the dialog for the user to choose the account of the drive to connect, qd actually I should inform via programming my account (from where the download will be made) and the user should not be aware of it. (simply press the download button and you’re done) someone knows how to report this account in my code?

My code:

@Override
    protected void onResume() {
        super.onResume();
        if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(Drive.API)
                    .addScope(Drive.SCOPE_FILE)
                    .addScope(Drive.SCOPE_APPFOLDER)
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .build();
        }
        mGoogleApiClient.connect();//vai dar falha pq nenhuma conta foi informada
    }

and in onFail the code q launches the dialog (this part should be replaced by my account information... but as?)

@Override
    public void onConnectionFailed(ConnectionResult result) {
        if (!result.hasResolution()) {
            Log.i(TAG, "Erro! " + result.toString());
            return;
        }

        try {
            //esse cod lança o dialog
            result.startResolutionForResult(this, REQUEST_CODE_RESOLUTION);
        } catch (SendIntentException e) {

        }
    }

Would anyone know how to do it? Or would you have some other idea of how I inform this account via programming?

Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.