I worked long and hard trying to integrate Google Drive in android application. But that's a trap - Google as always surprised - in a bad sense. It all started with the fact that I relied on the instructions (first, first) from Google. I fulfilled all the conditions - created OAuth 2.0, created a key for the application, the application reg., imported libraries ... generally did everything they asked and 100 times rechecked. But as expected did not work - in the first case is made all the example, I received a "403 Forbidden Access Not Configured", the second one can not be implemented, because that Google has not issued a secret key. Throughout the week, I was looking for alternative solutions to this problem - a lot of examination of information, a lot of effort and time spent - but the result is 0. Glimmer of hope came through general questions ArtOfWarfare. But the code that he proposed, and which allegedly he works, I do not work - I allow the application to use the account, followed by whose connection fails because of "communication error with Google", repeated attempts yield the same result. As a result, I drew "their" code just to try to communicate with the drive. Since I'm writing here - hence it does not work. Code shown below returns a "400 Bad Request Invalid Upload Request",". Do you have any ideas on how to solve this problem with authorization, or are there other ways of successful login? I'll be glad constructive conversation.package com.example.hiv;import java.io.IOException;import android.accounts.AccountManager;import android.accounts.AccountManagerCallback;import android.accounts.AccountManagerFuture;import android.accounts.OperationCanceledException;import android.app.Activity;import android.os.Bundle;import android.util.Log;import com.google.api.client.extensions.android.http.AndroidHttp;import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;import com.google.api.client.googleapis.services.GoogleKeyInitializer;import com.google.api.client.http.FileContent;import com.google.api.client.http.HttpTransport;import com.google.api.client.json.JsonFactory;import com.google.api.client.json.gson.GsonFactory;import com.google.api.services.drive.Drive;public class ActivityStart extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_activity_start); String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/drive"; AccountManager accountManager = AccountManager.get(this); accountManager.invalidateAuthToken(accountManager.getAccounts()[0].type, null); accountManager.getAuthToken( accountManager.getAccountsByType("com.google")[0], AUTH_TOKEN_TYPE, null, this, new AccountManagerCallback<Bundle>() { public void run(final AccountManagerFuture<Bundle> future) { try { String authToken = future.getResult().getString( AccountManager.KEY_AUTHTOKEN); final HttpTransport transport = AndroidHttp.newCompatibleTransport(); final JsonFactory jsonFactory = new GsonFactory(); GoogleCredential credential = new GoogleCredential(); credential.setAccessToken(authToken); final Drive drive = new Drive.Builder(transport, jsonFactory, credential) .setApplicationName("HIV") .setGoogleClientRequestInitializer(new GoogleKeyInitializer("*****yDaPx1EtTHpMMMULzYlxjc3xdwsf******")) .build(); Thread t = new Thread(new Runnable() { @Override public void run() { try { final com.google.api.services.drive.model.File body = new com.google.api.services.drive.model.File(); body.setTitle("My Test File"); body.setDescription("A Test File"); body.setMimeType("text/plain"); java.io.File fileContent = new java.io.File("data/data/com.example.hiv/document.txt"); FileContent mediaContent = new FileContent("text/plain", fileContent); com.google.api.services.drive.model.File file = drive.files().insert(body, mediaContent).execute(); } catch (UserRecoverableAuthIOException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); t.start(); } catch (OperationCanceledException exception) { // TODO } catch (Exception exception) { Log.d(this.getClass().getName(), exception.getMessage()); } } }, null); } }