Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant Upload based on folder observance instead of broadcasted events #6

Closed
schiessle opened this issue Oct 31, 2012 · 76 comments
Closed

Comments

@schiessle
Copy link

We discussed and debugged the issue already on IRC some time ago. It seems that the camera App from HTC does something different which doesn't trigger the instant upload. Tested with HTC Desire S (Android 2.3.5, HTC Sense 3.0) and the ownCloud Android Client 1.3.8

EDITED by @davivel
SUMMARY on 26/02/2016

The problem: third party camera apps often fail to broadcast the Intents with action android.hardware.action.NEW_PICTURE and android.hardware.action.NEW_VIDEO that the OC app listens for to know when a new picture or video was taken.

The probable solution: keep alive a FolderObserver on the official folder where pictures / videos are stored to know when a new picture or video was taken.

Main references on this:
#6 (comment)
#6 (comment)
#1059

To keep in mind:

  • There are third party camera apps that don't use the official DCIM folder to store their captures; let's ignore them first.
  • Android Services are not granted to be there forever; this could result in problems to keep the FolderObserver alive; risk is low, since that's the approach already used to observe kept-in-sync / favourite files, and our experience in this point has been fine.
  • The app keeps too many Services. We should tend to merge them in a different architecture, with a more uniform synchronization model. Internally, the concept of 'instant upload' should evolve to 'automatic addition, later sync'.
@rperezb
Copy link

rperezb commented Oct 31, 2012

Yes, we are awared of that. Instant uploads does not work on those devices, such HTC ones, whose camara app is not the Android original one.

@simonbuehler
Copy link

@rperezb
Copy link

rperezb commented Jan 14, 2013

Thanks @simonbuehler we will look into this

@daliusm
Copy link

daliusm commented Jan 24, 2013

i can confirm, there is same problem with HTC Desire S Android 4.0.4, HTC Sense 3.6.

@simonbuehler
Copy link

https://github.com/meltedxice/InstantUpload should have everything needed

@jimlepoulpe
Copy link

Same problem here...

@pascalBokBok
Copy link

So what is the status of HTC camera instant upload?

@simonbuehler
Copy link

still not working =[

@Webdroid
Copy link

Webdroid commented May 9, 2013

Same on HTC Evo 3D & HTC One SV

@UlkUpp
Copy link

UlkUpp commented May 28, 2013

Not working on HTC One X either.

@mhellwig
Copy link

I seem to have a similar problem on a Motorola Droid 4 (XT894), which also brings its own camera app.

"instant upload" just does nothing. On my old phone (a Sony/Ericsson Xperia Mini Pro) it worked fine

@alfsoft
Copy link

alfsoft commented Jun 18, 2013

Instant upload does not on HTC One S. I've manually created the InstantUpload folder - no effect. I've changed my android device language to English - no effect. The Auto Upload option simply does nothing.

@davivel
Copy link
Contributor

davivel commented Jun 27, 2013

Please, let me edit the title.

@simonbuehler
Copy link

is #181 the solution for this?

@davivel
Copy link
Contributor

davivel commented Jun 28, 2013

No, it isn't. That branch name can be improved a lot :) .

Work for this issue is being addressed in the branch fixCameraTrigger. Don't know how available is @zerginator to keep on working on this. And maybe we should test and merge the changes previous to the last commit there, since the problem would be solved at least for HTC devices with Android 4.0 or later.

Are you there, @zerginator ?

@pmolaughlin
Copy link

Chiming in on this issue. Obviously same behavior on my HTC EVO 4G.

@elforesto
Copy link

This also affects the Evo 4G LTE.

@LukeOwlclaw
Copy link

A while ago I proposed a fix for Android 4 devices which has no impact on older devices.(--> #111)
Now I have write-access and I will merge my changes into develop branch.

@WilliamFromTW
Copy link

owncloud app can only detect picture taken from android built-in camera.
so I disable new picture receiver and write a service "ObserveNewPhotoService".
this service use com.owncloud.android.utils.RecursiveFileObserver
to watch new media file created in directory "DCIM" , "Pictures" and all sub-directory,
, if media files were created , ObserveNewPhotoService will upload these media files to owncloud server.

owncloud_new_photo_observer_src.zip and compiled apk can download from
http://mail.pumpkin-village.tk/owncloud/public.php?service=files&t=df53555ce62fbb2e6f8385a700e1f355

ps. not only picture. video file can also be detected and upload to server.


2013/09/26
i had open one repository for this solution , source code can be found in
https://github.com/willyann/owncloud_new_photo_observer

basically this service will observe new media(image, video) created in two directory and it's sub directory
Environment.DIRECTORY_DCIM(api level 8)
Environment.DIRECTORY_PICTURES (api level 8)
confirm cell phone : hTC desire z (2.2), hTC desire HD(2.2), some android phone(no brand) , hTC J , hTC one X , hTC new one , nexus s , galaxy nexus , nexus 4 , hTC sv , moto me860(2.2),samsung s2,s3,note2,hTC Wildfire S

@davivel
Copy link
Contributor

davivel commented Aug 13, 2013

@willyann , thanks for your collaboration.

Could you tell us if noticed worse battery performance with your modification?

@WilliamFromTW
Copy link

@davivel
, no , just use service instead of "com.android.camera.NEW_PICTURE" receiver.
maybe you concern with cpu or battery performance , this new service "ObserveNewPhotoService" just start recursive fileobserver (observe a few directory in DCIM or Pictures , can also modify observe one directory).
fileobserver use inotify (Linux kernel system) , so it is not always scanning file system , is waiting for inotify to trigger.
this method is very similar with dropbox.
dropbox can detect DCIM and all subdirectory.

@simonbuehler
Copy link

great work 👍

@schiessle
Copy link
Author

@willyann Sounds like a great solution. 👍 Personally I no longer have a HTC device but there are a lot of HTC devices out there. So it would be really great to fix the issue and to make the whole process of detecting new pictures more independent from a specific camera app.

@mellynce
Copy link

讚 👍

@jsteel44
Copy link

@willyann it works on my HTC Wildfire S, Android 2.3.5 thanks! However if my (local) server is off, the upload fails (as expected) but it does not try again when the server is back up.

@WilliamFromTW
Copy link

@jsteel44 i test as original app (1.4.4 ) , have the same issue ..

@davivel
Copy link
Contributor

davivel commented Aug 16, 2013

@jsteel44 , the retry of failed uploads (instant or not) at network recovery is a different problem. There are other issues describing it, such as #165 and #64. There is also some work in progress in the branches starting with 'offline'.

@davivel
Copy link
Contributor

davivel commented Aug 17, 2016

Going for it.

@davivel
Copy link
Contributor

davivel commented Aug 29, 2016

The fix has been merged. Due to its historical importance, I'd like to keep the issue open for a while to get some feedback when the fix is released.

That will be very soon. We will reschedule the current plan and release a version 2.1.1 with the current job done in the milestone 2.2.0. The total loss of instant uploads of pictures in Android 7 is too serious to wait more time.

I will update milestones in a while. Stay tuned :)

@davivel
Copy link
Contributor

davivel commented Sep 1, 2016

Release 2.1.1 is out now. Please, take a look to the option 'Camera folder' in instant upload settings to select the folder where your camera app stores the pictures, and give it a try. The new implementation will observe that folder and upload new pictures or videos in it.

We expect this solution works with most of the camera apps that were already working, and with most of the camera apps that were not working at all.

Looking forward your feedback :)

@Fukurokudzu
Copy link

Just tried it on my Huawei Honor 7 (android 6.0) with stock camera and didn't succeed.
Camera is set to store photoes on ext_sd, so i set owncloud to look into /storage/6F4B-1E08/DCIM/Camera (photoes goes there, i checked) with no luck. Right after installation OC asked permission access for sdcard, if it matters.

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

Thanks, @Fukurokudzu . There are some things pending to check about permissions and ext_sd, probably your problem is about that.

The camera stores the pictures there by default, or is it configurable? In the second case, could you change it to a location in emulated external storage (public internal) and make another test? Just to know about the Huawei camera app.

EDIT: I just saw your previous comments, I guess that for you it's the same as before, right? Working form local storage but not from SD Card. Can you see failed uploads in the 'Uploads' list with the new solution, or nothing at all?

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

@gw0, could you try Camera Collage with ownCloud 2.1.1? Thanks.

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

@mhellwig , @rlaban , @LukeOwncloud , @redfave , some feedback from you would be really awesome :) . Thanks

@cschwarz007
Copy link

I tried on my Samsung A3 (2016) with Android 6.0.1 Neither storing the pictures on the SD-Card nor on the internal storage works. Tried both OpenCamera and the Samsung stock camera app...

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

OpenCamera is one of our test apps. Could you double check with it, please? Remember to chose in the app settings "DCIM/OpenCamera" as camera folder.

@cschwarz007
Copy link

Hi David, it works with OpenCamera but only if I set "Use Storage Access Framework" to off. Does not work with OpenCamera if Storage Framework is enabled (regardless where the pictures are saved) nor with the built-in Samsung camera app (which always uses the framework I suppose)... Hope this helps and/or let me know what other info I can provide to support...

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

Sure it helps, @cschwarz007 . That's a variable we didn't take into account. I'll think a bit about it, probably we'll need to open a new issue to deal with it.

@Fukurokudzu
Copy link

@davivel ok, i set camera to store photos on internal storage. OC shows /storage/emulated as empty folder, so i just can't select internal storage there. I set OC to look into /sdcard/DCIM/Camera (new files are there) and still no luck with instant uploads. Uploads list is empty (i reinstalled the app last night just to be sure).

@davivel
Copy link
Contributor

davivel commented Sep 2, 2016

Thanks, @Fukurokudzu . I expected that /sdcard/DCIM/Camera worked fine... Will have to research a bit more, maybe the Storage Access Framework is related, as in the case of @cschwarz007

@Fukurokudzu
Copy link

@davivel well, maybe, but i'm just a user, i've just learned what SAF is and can't recall any settings, connected to this technology.

@davivel
Copy link
Contributor

davivel commented Sep 7, 2016

@cschwarz007 , @Fukurokudzu , maybe you are interested in #1795 (comment)

@cschwarz007
Copy link

@davivel Thanks a lot - this solved the issue on my (meanwhile) Sony X5 Compact (and I am sure it would work on Samsung too).

@davivel davivel modified the milestones: 2.1.2, 2.2.0 Sep 13, 2016
@davivel
Copy link
Contributor

davivel commented Sep 14, 2016

Thanks for the feedback. Version 2.1.2 is already pushed to Play Store, will be soon in your devices with the combined solution (FileObserver + broadcast event).

For sure, this is not the last word in improvements about instant_uploads. There are plenty of things to do in https://github.com/owncloud/android/issues?q=is%3Aopen+is%3Aissue+label%3Async%3A%3Ainstant_upload , and we'll continue to address them, with your help.

@davivel davivel closed this as completed Sep 14, 2016
nganntk pushed a commit to projectkit/pkdrive-android that referenced this issue Aug 9, 2017
nganntk pushed a commit to projectkit/pkdrive-android that referenced this issue Aug 9, 2017
…tra không có internet thì không bật webview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests