Android: Don't download photos to local storage unless explicitly told to by the user

Created on 26 Sep 2018  路  11Comments  路  Source: owncloud/android

Actual behaviour

-Photos are downloaded to local storage, rather than cached.

Expected behaviour

-When browsing a directory of photos, I don't want to have to wait for each photo to be downloaded and stored locally before being able to view them.
-The behavour of video files is to stream them unless given the action to download. Photos should follow similar logic.

Steps to reproduce

  1. Create a folder on a remote server and add photos
  2. Navigate to the folder via the owncloud android app
  3. Have you local storage fill up trying to just view the files in the folder.

Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)
Yes

Environment data

Android version: 8.1 Sept 5th patch

Device model: Nexus 6p

Stock or customized system: Stock android

ownCloud app version: 2.8.0

ownCloud server version: 10.0.8

discussion enhancement

Most helpful comment

thanks for your feedback. We will think about it... this feature was already suggested and make sense not to keep everything downloaded. There are many choices to do that, we can use the current issue to discuss and get the better approach.

All 11 comments

I am looking into this.

@stupidly-logical ok, also you can contribute in other stuff labelled as Contributions are welcome or good first issue. The current one is not an easy one (some implications to face), but if you are confident yourself, go ahead!

A user on GooglePlay asked for the same feature, but with music instead of images.

And another user added pdfs. can we just do this with files in general? Let them open by other apps and delete afterwards?

this issue, and other ones, are in the same scope of not handling with downloaded files. This is, when you open a file, it is removed just after, and only stays in device in case of offline availability. We can gather all issues with the same topic and check which background and if it is really worthy to change the current behaviour of the downloaded stuff.

CC @michaelstingl

This "problem" really annoys me, too, since many apps on the phone then will show these images after they were downloaded just by viewing them.
An major use-case for me is to have all my photos in my owncloud and not on my phone but if viewing them will cause the photos to be "permanently" stored on my device again, it's nothing worth to initially get them off my phone and in my owncloud :(

thanks for your feedback. We will think about it... this feature was already suggested and make sense not to keep everything downloaded. There are many choices to do that, we can use the current issue to discuss and get the better approach.

I think the easiest way - on Android's API-side would be this
https://developer.android.com/training/data-storage/files.html#WriteCacheFileInternal

even if i see, there're some abstraction layers in your code, for someone knowing where the actual downloading (and checking, if already downloaded) is taking place, it should be totally easy to replace possibly this
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(fileContents.getBytes());
outputStream.close();

with that
String fileNameWithoutPath = Uri.parse(filename).getLastPathSegment();
file = File.createTempFile(fileNameWithoutPath, null, context.getCacheDir());

I think the easiest way - on Android's API-side would be this
https://developer.android.com/training/data-storage/files.html#WriteCacheFileInternal

even if i see, there're some abstraction layers in your code, for someone knowing where the actual downloading (and checking, if already downloaded) is taking place, it should be totally easy to replace possibly this
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(fileContents.getBytes());
outputStream.close();

with that
String fileNameWithoutPath = Uri.parse(filename).getLastPathSegment();
file = File.createTempFile(fileNameWithoutPath, null, context.getCacheDir());

Thanks for your suggestion @gutiar-junky , would you like to contribute with that? It would be great

Hello. I wanted to pile onto this thread and throw my support behind it. I think it would be a great idea to have the app able to stream media in general. Music and pictures both, since oddly it already streams video naturally. I have created my Owncloud as a media hub with the intent to access it on mobile. With the Owncloud Audio player and Gallery apps I can achieve this via Chrome browser but not the android app which would be much better. Full disclosure I am not a dev....Github needs a box that says "User" instead of Collaborator. :-) Since I have this all setup I am absolutely willing to help test or anything else that will help this effort if it becomes viable. Cheers!

@tikidad This issue is about photos.

ownCloud Android app supports streaming of supported video files since early 2017. If you encountered a bug, then please open a new issue.

Related: https://github.com/owncloud/android/issues/592, https://github.com/owncloud/android/pull/1907

For music streaming, please also discuss in another issue to reduce noise.

Was this page helpful?
0 / 5 - 0 ratings