开发者

Android -- How does Google+ instant upload work?

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 into the native camera application?

I can turn on a feature in the Google+ application and any pictures that I take with the native camera app are aut开发者_Python百科omatically uploaded to a private album on Google+. And this seems to be true whether the Google+ application is currently running or not. Is there any type of hook that I can register a callback event for in my application to access "just-taken" pictures for some post-processing goodness? I'd really like to tap into this functionality for an application that I am currently writing.

Any insight or hints in the right direction are greatly appreciated! Thanks!


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 ContentObservers (which I'm assuming is all ContentProviders, 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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜