Listen to photo taken event

≡放荡痞女 提交于 2019-12-07 01:16:29

Found a way by registering to all sub directories of dcim (except the ones that start with a period):

new FileObserver(dcimDir.toString(), FileObserver.CLOSE_WRITE)

The reason I need to register to all of them is because different phones put picutes and videos in different folders - at least they are all under DCIM.

The reason the event is 'CLOSE_WRITE' is because I want to trigger after the photo/video is complete, so I won't process only half of the photo/video.

AlikElzin-kilaka

There is another way: ContentProvider

See another SE thread for more info: Android -- How does Google+ instant upload work?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!