title: Upload file to Google drive (Owned account) in android?
body: <p>I am working in owned account google-drive implementation in android. I have to complete the authorization process (<a href="https://developers.google.com/drive/web/service-accounts" rel="nofollow">https://developers.google.com/drive/web/service-accounts</a>), then trying to upload a file to Google drive. some of the tutorial using token to upload it. But i didn't know where to get the token_id from "Drive". I'm new in android development, so. If any idea for this, please let me know.</p>
  
  <p>Thanks in Advance</p>
  
  <p>I have tried this:</p>
  
  <p>Authorization process</p>
  
  <pre><code>                  try 
                    {
                          System.out.println("HARDCODE CREDENTIALS here");
                             credential = new GoogleCredential.Builder()
                                .setTransport(httpTransport)
                                .setJsonFactory(jsonFactory)
                                .setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
                                .setServiceAccountScopes(DriveScopes.DRIVE)
                                .setServiceAccountPrivateKeyFromP12File(tempPkc12File)
                                .build();
                      } 
                      catch (GeneralSecurityException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } 
                      catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
  
  
                  Drive service = new Drive.Builder(httpTransport, jsonFactory, null)
                        .setHttpRequestInitializer(credential)
                        .setApplicationName("Sample Owned Account")
                        .build();
  
  
  
   final File body = new File();
                  body.setTitle("My document");
                  body.setDescription("A test document saf hkfhflkhs;lkhlf h;ls;afhsa;lk");
                  body.setMimeType("text/plain");
  
                  java.io.File fileContent = new java.io.File("document.txt");
                  final FileContent mediaContent = new FileContent("text/plain", fileContent);
  
                  Thread thread = new Thread()
                  {
                      @Override
                      public void run()
                      {
                          try {
                              File file = service.files().insert(body, mediaContent).execute();
                              System.out.println("File ID: " + file.getId());
                          } catch (Exception e) {
                              e.printStackTrace();
                          }
                      }
                  };
                  thread.start();
  </code></pre>