I was playing around with the new Google+ application on the Android and I had a technical question that I couldn\'t seem to find online. How does the instant upload hook in
Not entirely sure exactly how Google+ does it, but one way that would work is to use the ContentObserver interface: grab the MediaStore.Images.Media ContentProvider
and attach a ContentObserver
to it. Anytime a camera image is added, you'll get a notification and you can process it accordingly (including uploading).
Same technique would work for just about any ContentProvider
that properly handles ContentObserver
s (which I'm assuming is all ContentProvider
s, but you never can tell).
Thanks to Femi's answer in this post, I was able to take what he said and figure out how to emulate Google+'s Instant Upload feature. I wrote a tutorial about it here:
http://www.jessechen.net/blog/how-does-google-plus-instant-upload-work/