Giter Site home page Giter Site logo

googlearchive / drive-android-quickstart Goto Github PK

View Code? Open in Web Editor NEW
238.0 28.0 159.0 582 KB

[MOVED] Quickstart application showing the Google Drive API for Android

Home Page: https://github.com/gsuitedevs/android-samples

License: Apache License 2.0

Java 100.00%

drive-android-quickstart's Introduction

This repo has been moved to android-samples.


Google Drive Android Quickstart

This application provides a single activity designed to get you up and running with the Google Drive API for Android.

What does it do?

  • Takes photos and stores them in Drive
  • Displays a file picker to the user to select where to save files
  • Shows you how to write file content
  • Shows you how to set file metadata including title and MIME type

How can I run it?

  1. Create an OAuth 2.0 client as described in the Getting Started guide.
  2. Make sure you have Google Play Services development set up correctly.
  3. Grab the source and create a project in your IDE
  4. Run and edit!

What does it look like?

File chooser to create files

Analytics

drive-android-quickstart's People

Contributors

aliafshar avatar grant avatar jfschmakeit avatar kroikie avatar paolorotolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drive-android-quickstart's Issues

Failed to create new contents. API failed to connect while resuming due to an unknown error.

Hi there,

I am getting follwing error after capturing the image.

11-09 12:27:45.537 6671-6671/genetechsolutions.intentsdemo I/drive-quickstart: Sign in request code
11-09 12:27:45.537 6671-6671/genetechsolutions.intentsdemo I/drive-quickstart: Signed in successfully.
11-09 12:27:52.751 6671-6677/genetechsolutions.intentsdemo W/art: Suspending all threads took: 8.588ms
11-09 12:27:55.041 6671-6671/genetechsolutions.intentsdemo I/drive-quickstart: capture image request code
11-09 12:27:55.041 6671-6671/genetechsolutions.intentsdemo I/drive-quickstart: Image captured successfully.
11-09 12:27:55.042 6671-6671/genetechsolutions.intentsdemo I/drive-quickstart: Creating new contents.
11-09 12:29:47.570 6671-6671/genetechsolutions.intentsdemo W/drive-quickstart: Failed to create new contents.
                                                                               com.google.android.gms.common.api.ApiException: 8: API failed to connect while resuming due to an unknown error.
                                                                                   at com.google.android.gms.common.internal.zzb.zzz(Unknown Source)
                                                                                   at com.google.android.gms.common.api.internal.zzg.zzu(Unknown Source)
                                                                                   at com.google.android.gms.common.api.internal.zze.zzt(Unknown Source)
                                                                                   at com.google.android.gms.common.api.internal.zzbr.zzx(Unknown Source)
                                                                                   at com.google.android.gms.common.api.internal.zzbr.zzahy(Unknown Source)
                                                                                   at com.google.android.gms.common.api.internal.zzbp.handleMessage(Unknown Source)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                   at android.os.Looper.loop(Looper.java:148)
                                                                                   at android.os.HandlerThread.run(HandlerThread.java:61)

I registered my package on google console.
I have updated the google play services too.

I have also noticed that google play services is crashing after my app installed too.
whats going on.
any directions?

Error: Calling connect() while still connected, missing disconnect()

Thank you for your quick start sample, I was able to use the standalone app, took photo and saved to my G-drive.

I then tried to integrate with my app and started an new activity to this class using intent. I did not make any change to the class other than the class name. The app ran, I could see the camera app and able to take picture. My G-drive "Upload to Drive" screen pops up, showing the file name, account and root folder of My Drive, I could also browse on the My Drive button and choose folders. However, when I clicked ok, the app crashed.

The logcat record:
08-26 16:54:49.761: I/g-drive-quickstart(1566): API client connected.
08-26 16:54:49.761: I/g-drive-quickstart(1566): Creating new contents.
08-26 16:54:49.851: I/g-drive-quickstart(1566): New contents created.
08-26 16:56:58.271: E/GmsClient(1566): Calling connect() while still connected, missing disconnect().
08-26 16:56:59.271: I/g-drive-quickstart(1566): API client connected.
08-26 16:56:59.271: I/g-drive-quickstart(1566): Creating new contents.
08-26 16:56:59.311: I/g-drive-quickstart(1566): New contents created.

Kindly let me know what could be the problem. Appreciate your helps.

how to know if user denied access?

hi.
i am looking into integrating some functionality of google drive in my app and i have immediately noticed something that's missing.
if the app is not yet authorized, i get this error message:
GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{a846aa3: android.os.BinderProxy@ff141a0}, message=null}

assuming this is the first time the user is trying to connect, then the "choose account" and permission dialogs will display. in the permission dialog, the user can choose to either accept or deny. i would like to catch the event where a user denies the permission and display an appropriate message - however,
the exact same error message is logged.
how can i differentiate between "user denied permissions" event to other events? (like the first time the user is trying to connect)

Google Drive Error on import

Hi I have already followed the instructions conducted at your video on youtube
"Google Drive SDK: Writing your first Drive app on Android" unfortunately I'm having an error at these:

**The import com.google.android.gms.drive.DriveApi.OnNewContentsCallback cannot be resolved.

**The type MainActivity must implement the inherited abstract method GoogleApiClient.ConnectionCallbacks.onConnectionSuspended(int)

Please help!

ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}

I have registered my SHA1 key with pakagename but i got this error.

Have repeated registration processs so many times but each time i get internal error.

I also registered my private key and package name and then exported the apk but same error.

I have enable drive api and drive skd.

EDIT:

I change pakage name to com.skyproductivity.android.sample.quickstart and re registered Auth client 2.0. but still same error.

I am using Eclips with play service 15.

Dead link in README.md

Hi,

Just to inform you that the first link of the README and called"Single activity" is dead.

Android Open and Save String to/from Google Drive SDK

I have read allot about Google drive integration and I want to save STRING into Google drive and also to retrieve, I have used this demo please anyone provide me demo for my requirement
i have read that, but how can i retrieve the data that i saved?
that only saved the data to drive, is there any code to get that particular data

not woking

after choose account app recall account choose dialog

Android Google Drive API increases file size after re-download

I am using google drive API to store images in google drive. I do some optimizations on image size (decrease image quality) before uploading the file. File is uploaded to appdata folder. After restoring images from google drive, somehow file size of images get increased by a significant amount.

After repeating this behavior, i can see a pattern, which is:

more colorful image is, it's size will increase in that ratio.

i.e black and white image will get a little bump in size and a colored image may get double of its original size.

I wonder how can google drive alter my data.

Original image
Original image

Image after restore from google drive
Image after restore from google drive

Only single file was deleted for this screenshot

Copied from my original question at stackoverflow

Unknown issue with Google play services

Log:

I/BaseDriveActivity(5657): GoogleApiClient connection failed: ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}

always showing same error, am using Eclipse KEPLER and gooleplayservices rev 14, help me to solve this issue

screenshot_2014-02-18-12-31-01 1

Gradle complaining with original code

It gives me this error message at first build:

Error:Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

What should i do?

Can not compile https://github.com/googledrive/android-quickstart sample project

Hi There,
I need help with importing / running this Android google drive quick start sample project in Eclipse.
https://github.com/googledrive/android-quickstart sample project
The code i downloaded was from this link below:
https://github.com/googledrive/android-demos/archive/master.zip

My problem: It does not compile.
Whether I create a ne project with the same class / package name, or After i import the project as is using the Eclipse import faclity, the project does not compile.
I get like 612 errors.
All of them looks like eclipse can not find certain class paths or something similar.
Example errors:
Description Resource Path Location Type
AndroidManifest.xml file missing! HomeActivity Unknown Android Packaging Problem _ BUT YET the file is present
Description Resource Path Location Type
ChangeEvent cannot be resolved to a type ListenChangeEventsForFilesActivity.java /HomeActivity/src/com/google/android/gms/drive/sample/demo/events line 116 Java Problem
and many more like that.
I tried cleaning the project, but not working

Can some one PLEASE PLEASE HELP?

Connection Fails, SIGN_IN_REQUIRED

I just cloned this repository and opened it in Android Studio, built and ran it on my Nexus 6P, without making any changes, and when the account chooser pops up, no matter which account I choose, i get this error message immediately logged:

I/drive-quickstart: GoogleApiClient connection failed: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{bd2ce36: android.os.BinderProxy@75a7137}, message=null}

Again, built straight from source, no changes, just doesn't work.

Also, the resolution intent is not handled in onActivityResult, so not sure what to do if this were to happen in production.

Access to the whole Drive not allowed

I'm trying to use this API to access all files on user's Drive, but it is not possible:

  1. Using Drive.SCOPE_FILE only lists New Folder as a child of the root folder (client.rootFolder)
  2. Using just Scope("https://www.googleapis.com/auth/drive.readonly") fails with:
java.lang.IllegalArgumentException: You must request a Drive scope in order to interact with the Drive API.
       at com.google.android.gms.common.internal.zzbq.checkArgument(Unknown Source)
       at com.google.android.gms.drive.Drive.zza(Unknown Source)
       at com.google.android.gms.drive.Drive.getDriveResourceClient(Unknown Source)
  1. Using both scopes: requestScopes(Drive.SCOPE_FILE, Scope("https://www.googleapis.com/auth/drive.readonly")) seems to ignore the latter one and still only lists the New Folder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.