owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.84k stars 3.06k forks source link

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

Closed schiessle closed 8 years ago

schiessle commented 12 years ago

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: https://github.com/owncloud/android/issues/6#issuecomment-22494946 https://github.com/owncloud/android/issues/6#issuecomment-60381095

1059

To keep in mind:

rperezb commented 12 years ago

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 commented 11 years ago

http://stackoverflow.com/questions/4571461/broadcast-receiver-wont-receive-camera-event

especially

http://code.google.com/p/picasaphotouploader/source/browse/trunk/src/com/android/picasaphotouploader/PicasaPhotoUploader.java?r=4

its basically monitoring the sd card for new images, should work for htc devices (app seems to eat event)

rperezb commented 11 years ago

Thanks @simonbuehler we will look into this

daliusm commented 11 years ago

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

simonbuehler commented 11 years ago

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

jimlepoulpe commented 11 years ago

Same problem here...

pascalBokBok commented 11 years ago

So what is the status of HTC camera instant upload?

simonbuehler commented 11 years ago

still not working =[

Webdroid commented 11 years ago

Same on HTC Evo 3D & HTC One SV

UlkUpp commented 11 years ago

Not working on HTC One X either.

mhellwig commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

Please, let me edit the title.

simonbuehler commented 11 years ago

is https://github.com/owncloud/android/pull/181 the solution for this?

davivel commented 11 years ago

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 commented 11 years ago

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

elforesto commented 11 years ago

This also affects the Evo 4G LTE.

LukeOwlclaw commented 11 years ago

A while ago I proposed a fix for Android 4 devices which has no impact on older devices.(--> https://github.com/owncloud/android/pull/111) Now I have write-access and I will merge my changes into develop branch.

WilliamFromTW commented 11 years ago

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 commented 11 years ago

@willyann , thanks for your collaboration.

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

WilliamFromTW commented 11 years ago

@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 commented 11 years ago

great work :+1:

schiessle commented 11 years ago

@willyann Sounds like a great solution. :+1: 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 commented 11 years ago

讚 :+1:

jsteel44 commented 11 years ago

@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 commented 11 years ago

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

davivel commented 11 years ago

@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'.

rperezb commented 11 years ago

Hi! On the latest version, 1.4.5, published yesterday it has been included a bug fixed in this sense. Right instant upload works on HTC devices with Android 4.0 or greater.

davivel commented 11 years ago

Hi everybody.

Would be great that all of you with an Android 4.x device check the 1.4.5 version and tell us if instant uploads are working now.

Thanks in advance.

mhellwig commented 11 years ago

Motorola Droid 4 (XT894 aka maserati): still not working.

tun0 commented 11 years ago

Instant image uploads work on HTC One. Videos don't get uploaded, but not sure if that's supposed to be like that or not.

davivel commented 11 years ago

Videos are not added, just pictures. There is other issue about instant upload of videos, but we won't adress it until instant uploads of pictures is better.

@mhellwig , may I assume that your Motorola is upgraded to Android 4.0?

mhellwig commented 11 years ago

@davivel indeed, 4.0.4

elforesto commented 11 years ago

This feature works on the HTC Evo 4G LTE with Android 4.1.1 and Sense 4+ running stock firmware.

davivel commented 11 years ago

@mhellwig , it should work, the new solution is based in catching the official action http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_PICTURE , that was introduced in Android 4.0.

Was your device originally shiped with Android 2.3? The problem could be caused by a bug in the update, or directly by a customization of the camera software by Motorola. Is very difficult to us know what happens in this point without a Droid 4 to test.

We can search other solutions, the proposal of monitoring the folder where photos are stored is very interesting (it covers devices from Android 2.2), but there is no grant that it works in any device, because the location of that folder could be other point of uncertainty in devices "customized" by the manufacturer.

Besides, we probably should choose between the monitoring and the current solution, keeping both would increase the complexity of the code to avoid duplicated uploads.

LukeOwlclaw commented 11 years ago

@mhellwig, could you download this app to check whether the action broadcast: https://play.google.com/store/apps/details?id=lt.andro.broadcastlogger

After starting the service and taking a picture you should see: "android.hardware.action.NEW_PICTURE" in the list.

Does it show up?

@davivel

Besides, we probably should choose between the monitoring and the current solution, keeping both would increase the complexity of the code to avoid duplicated uploads.

How about letting the user configure which option to use? The monitor path could also be set manually. Sure, that makes it more complex, but it would make sure that instant upload also works before Android 4.0

davivel commented 11 years ago

@LukeOwncloud , we are trying to evolve the app in the UX so that it's as easy to use as possible. Adding deeply-technical configuration options is not convenient in this sense. We want the app is friendly for not technological-savvy users.

And thanks for the link to the app, that's cool!

davivel commented 11 years ago

Ok, it's official. We fixed instant upload HTC 4.x devices and broke them in Samsung 4.x devices.

Oh, happy day...

Fix coming very soon.

mhellwig commented 11 years ago

@LukeOwncloud OK installed the broadcast monitor.

Took a picture.

Showing up after that: android.hardware.action.NEW_PICTURE and android.intent.action.MEDIA_SCANNER_SCAN_FILE

davivel commented 11 years ago

@mhellwig , this is still more crazy. Since android.hardware.action.NEW_PICTURE is there, the update to 1.4.5 should work. Handling that event is the key in this update.

What happens exactly? There is no reaction from ownCloud when you take a new picture? Does your device have access to the server? Is there any other problem in your ownCloud app?

LukeOwlclaw commented 11 years ago

Bad news:

Just tried Broadcast Monitor on an HTC Desire C, Android 4.0.3 (stock): No action at all is received when taking a picture. (Did not try owncloud 1.4.5, yet. 1.4.4 did not instant upload anything.)

davivel commented 11 years ago

O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o O_o

davivel commented 11 years ago

Hi everybody here.

ownCloud app 1.4.6. was released on Friday. If fixes instant uploads for all the devices with Android version 4.0 or greater.

Those of you having problems with this, could you check how is the app doing now in your devices?

Thanks in advance.

LukeOwlclaw commented 11 years ago

HTC Desire C still does not work (Android 4.0.3 (stock) ): But as I said before: No action at all is received when taking a picture. So here only helps the file system watcher solution.

davivel commented 11 years ago

Thanks HTC and Samsung for removing standard API events from your systems. :(

Maybe somebody here wants to integrate the watcher solution in the code of the app, try it a while and make a pull request? @willyann? Somebody else ?

pmolaughlin commented 10 years ago

Still does not work on HTC Evo 4G because it is running Android 2.3.5

ghost commented 10 years ago

Is there any progress? I see the task is still open and not assigned to any milestone. I am using HTC Desire with android 2.3.5 and the latest owncloud app 1.5.7.

When taking a picture with the built in app, there is NO event triggered. I used https://play.google.com/store/apps/details?id=lt.andro.broadcastlogger to verify the events.

ghost commented 10 years ago

Hi there, I just signed up to watch this issue closer. I own only HTC devices and the owncloud client photo sync (while connected to wifi) does not work on them. My current device is an HTC Desire SV (dual sim). I also migrated from Dropbox with hopes of synching my photos.

Please fix the instant upload issue for HTC devices. Btw, what makes the dropbox client so different that it works?

LukeOwlclaw commented 10 years ago

@davivel I see there is a class FolderObserver now. Any plans to apply it for the photo folder as well?

android.os.Environment.DIRECTORY_DCIM should be the gallery path. Supported since API 8. Is that good enough? http://developer.android.com/reference/android/os/Environment.html#DIRECTORY_DCIM

redfave commented 10 years ago

I can confirm this issue on the Sony Xperia T runnig stock Android 4.3.