davols / android-light-dasftp

http://davols.github.io/android-light-dasftp/
Apache License 2.0
1 stars 0 forks source link

Fails on picasa/google+ pictures #1

Open davols opened 10 years ago

davols commented 10 years ago

Filepath is null when it comes to uploading picasa/G+ pictures.

See: https://groups.google.com/forum/#!topic/android-developers/s3BLfnI3F74 http://jimmi1977.blogspot.no/2012/01/android-api-quirks-getting-image-from.html and https://code.google.com/p/android/issues/detail?id=21234

Example:

D/Main    (12093): scheme:content
D/Main    (12093): ImageUri:content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh3.googleusercontent.com%2F7SXCyk18tPcC1RuvVjGj-ABN5hCB2-gofhhdydnW4BI%3Ds0-d
D/Main    (12093): filePath:null 
davols commented 10 years ago

Misc links: http://stackoverflow.com/questions/6978906/how-do-i-retrieve-the-picasa-id-url-of-an-image-from-the-gallery http://stackoverflow.com/questions/2632966/receiving-an-action-send-intent-from-the-gallery

davols commented 10 years ago

Several image sources that have pics online. More links: http://stackoverflow.com/questions/19805966/download-image-from-new-google-plus-photos-application http://stackoverflow.com/questions/21899884/download-image-from-new-google-plus-photos-of-gallery-with-image-extension

davols commented 10 years ago

See new file sharing stuff: http://stackoverflow.com/questions/20559392/getting-videosnon-local-from-the-google-photos-app http://developer.android.com/samples/StorageClient/index.html

ParcelFileDescriptor parcelFileDescriptor = context.getContentResolver()
               .openFileDescriptor(Uri.parse(path),"r");

FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();

InputStream inputStream = new FileInputStream(fileDescriptor);

BufferedInputStream reader = new BufferedInputStream(inputStream);

// Create an output stream to a file that you want to save to
BufferedOutputStream outStream = new BufferedOutputStream(
                    new FileOutputStream(filePath));
byte[] buf = new byte[2048];
int len;
while ((len = reader.read(buf)) > 0) {
    outStream.write(buf, 0, len);
}
davols commented 10 years ago

Seems to be working now with https://github.com/davols/android-light-dasftp/commit/cd04b1eae9baecc93cb6bc903e793e940e92c97b. With at least picasa, not thru Google Drive.