Android: choose multi folder for auto upload

Created on 12 Dec 2018  路  11Comments  路  Source: owncloud/android

Actual behaviour

-choose auto upload source, currently only the camra folder will be selected

  • in some cases , when using thirdparty app to take pictures, the pictures will be saved in a different folder

Expected behaviour

  • it should be able to choose more than one folder for auto upload

Steps to reproduce

  1. enable auto upload
  2. choose auto upload 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.0
Device model:
Huawei Mate 10
Stock or customized system:
Stock
ownCloud app version:
2.9.3
ownCloud server version:
10.0

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here
enhancement camera_uploads upload

All 11 comments

thanks for sharing your idea!

I will implement it.

One thing: currently, you can select the source folder for your camera uploads. If you install a different camera (not the built-in one), you can also select the folder of such camera as source.

You wrote:

it should be able to choose more than one folder for auto upload

my question is... at the same time?

Please, clarify a bit the scope of the issue

I recently discovered this problem.

When I got my new phone the photos are saved in one folder and my videos in a seperate one.

In owncloud you can only select one of theese folders as source.

I would like to add that I have have sub-folders for each camera app inside the DCIM folder, on the phone as well as on the SD card. However, I cannot even select a folder outside of the standard path, since all folders above seem to be empty if I browse them, and I cannot edit the path otherwise.

So, is this feature added yet to the application ? Only seen a beta 2.10 version release but dont know if this feature is added into that one. Should not be very hard to implement this feature.

@jonas740 the feature is not implemented yet

So, is this feature added yet to the application ? Only seen a beta 2.10 version release but dont know if this feature is added into that one. Should not be very hard to implement this feature.

If you know how to implement this, maybe you could send us a contribution, we will really appreciate it! 馃槈

@davigonz ye, send me the code and ill do it. Since there already is one entry for choosing a folder. It should not be anything more then to "copy/paste" that and tweak it just a little bit.

But I think you could manage that yourself.

Its not like you have to invent the wheel all over again. ;)

While we used the file observer to monitor new pictures inside a folder I think this was the wrong approach. We now face the problem presented in this issue. If we allow adding multiple folders that will alienate end users, because they have to manually add a path whenever an app decides to store media in a different folder.

The JobInfo.Builder.html#addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri) should be the right thing to use. probably not limited to just the DCIM_DIR but also paths that include well known apps like whatsapp and facebook. we should add that in code ... if need be add an option to add custom apps.

Thanks @butonic for your comment

While we used the file observer to monitor new pictures inside a folder I think this was the wrong approach.

We are no longer using file observer from one year ago, when we replaced _Instant uploads_ feature with _Camera uploads_ one and decided to use JobService.

The current implementation consists basically of a CameraUploadsHandler and a CameraUploadsSyncJobService which looks the camera folder set by the user for new pictures or videos every 15 minutes at least. Android system itself is the responsible for launching this job in background, taking into account the resources used by the system in every moment.

This is the way to proceed from now on since most recent Android versions will kill the tasks trying to be always active.

The JobInfo.Builder.html#addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri) should be the right thing to use.

Why was not addTriggerContentUri an option for us? Because it was added in API 24 so it would work just on Android 7+ devices while the current implementation is supported from Android 5.

We could try to improve our current Jobs implementation by using that option but many of our users (

Besides, there's some limitations such as _trigger URIs can not be used in combination with setPeriodic(long) or setPersisted(boolean)_ but should not be a blocker and could be easily overcome:

  • No more setPeriodic(long): this is used by the current implementation to execute the CameraUploadsSyncJobService every 15 minutes. If using this is not possible anymore, scheduling a new JobInfo observing the same URIs before we finish execution of the JobService would be enough.

  • No more setPersisted(boolean): jobs no longer persisted across device reboots => detect when the device is rebooted and schedule the job.

Any suggestion is welcome

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sd1998 picture sd1998  路  5Comments

sd1998 picture sd1998  路  6Comments

jesmrec picture jesmrec  路  7Comments

ldmpub picture ldmpub  路  4Comments

Nowaker picture Nowaker  路  3Comments