When the user downloads a new image or captures one using the camera, the gallery app will get updated to show the new images.
I need to be notified
You may want to look into adding these to your filter as well:
com.android.camera.NEW_PICTURE
com.android.camera.NEW_VIDEO
android.hardware.action.NEW_PICTURE
android.hardware.action.NEW_VIDEO
The android.hardware.x actions are the "official" current broadcasts, but the com.android.x ones are sent by Samsung devices and older versions of Android.
ACTION_MEDIA_SCANNER_FINISHED is used for adding new directories to the gallery:
Broadcast Action: The media scanner has finished scanning a directory. The path to the scanned directory is contained in the Intent.mData field.
Constant Value: "android.intent.action.MEDIA_SCANNER_FINISHED"
You should use ACTION_MEDIA_SCANNER_SCAN_FILE, which is used to add new files - not just directories:
Broadcast Action: Request the media scanner to scan a file and add it to the media database. The path to the file is contained in the Intent.mData field.
Constant Value: "android.intent.action.MEDIA_SCANNER_SCAN_FILE"
You can test this Intent
using the code discussed here.
Additionally, some have reportedly needed to include mime type and file extensions, such as:
<data android:mimeType="*/*"/>
<data android:pathPattern=".*\\.png" />
i think you can acheive this using the FileObserver .
as mentioned in the documentation :
Monitors files to fire an event after files are accessed or changed by by any process on the device . Each FileObserver instance monitors a single file or directory. If a directory is monitored, events will be triggered for all files and subdirectories inside the monitored directory.
but you have to keep in mind :
If a FileObserver is garbage collected, it will stop sending events. To ensure you keep receiving events, you must keep a reference to the FileObserver instance from some other live object.
Please give me some feedback . Hope That helps .