UserRecoverableAuthException: NeedPermission

Try following the Drive quickstart for Android, it is a step-by-step guide showing how to authorize and upload a file to Drive: https://developers.google.com/drive/quickstart-android To be more specific, it looks like you are not catching the UserRecoverableException and triggering the intent to have the user authorize the app. This is documented in the Google Play Services … Read more

Google Drive mime-types listing? [closed]

$mime_types= array( “xls” =>’application/vnd.ms-excel’, “xlsx” =>’application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’, “xml” =>’text/xml’, “ods”=>’application/vnd.oasis.opendocument.spreadsheet’, “csv”=>’text/plain’, “tmpl”=>’text/plain’, “pdf”=> ‘application/pdf’, “php”=>’application/x-httpd-php’, “jpg”=>’image/jpeg’, “png”=>’image/png’, “gif”=>’image/gif’, “bmp”=>’image/bmp’, “txt”=>’text/plain’, “doc”=>’application/msword’, “js”=>’text/js’, “swf”=>’application/x-shockwave-flash’, “mp3″=>’audio/mpeg’, “zip”=>’application/zip’, “rar”=>’application/rar’, “tar”=>’application/tar’, “arj”=>’application/arj’, “cab”=>’application/cab’, “html”=>’text/html’, “htm”=>’text/html’, “default”=>’application/octet-stream’, “folder”=>’application/vnd.google-apps.folder’ ); In addition, here is a list of mime-types specifically pertaining to Google drive (and the google suite): https://developers.google.com/drive/v3/web/mime-types

Google Drive API doesn’t play well with ProGuard (NPE)

A combination of the following has worked for me: -keep class com.google.** { *;} -keep interface com.google.** { *;} -dontwarn com.google.** -dontwarn sun.misc.Unsafe -dontwarn com.google.common.collect.MinMaxPriorityQueue -keepattributes *Annotation*,Signature -keep class * extends com.google.api.client.json.GenericJson { *; } -keep class com.google.api.services.drive.** { *; } This provided a working proguard compatible solution for a recent Google Drive project. Cannot … Read more

Error: invalid_request device_id and device_name are required for private IP

An alternative to editing a hosts file is to use the “Magic DNS” service https://nip.io/ nip.io is a magic domain name that provides wildcard DNS for any IP address. Say your LAN IP address is 10.0.0.1: 10.0.0.1.nip.io resolves to 10.0.0.1 (dot syntax) 192-168-1-250.nip.io resolves to 192.168.1.250 (dash syntax) 0a000803.nip.io resolves to 10.0.8.3 (hex syntax) foo.bar.10.0.0.1.nip.io … Read more

Using the google drive API to download a spreadsheet in csv format

Update: I have posted another answer that works with the Spreadsheets v4 API. Old Answer: The answer from Alain is correct, but you also need to set the gid=parameter to specify which worksheet to export. For example, if your ‘application/pdf’ export link is like this: docs.google.com/feeds/download/spreadsheets/Export?key=<FILE_ID>&exportFormat=pdf You can just change it to this to download … Read more