this should have been a FAQ on MEDIA RESCAN
my environment:
android 4.1.1
com.android.gallery3d is package for Gallery app that governs the cache and thumbnails.
gallery prefs are in: /data/data/com.google.android.gallery3d/shared_prefs/com.google.android.gallery3d_preferences.xml
<map>
<string name="pref_camera_recordlocation_key">none</string>
<int name="editor-update-image/*" value="312" />
<boolean name="prefs_sync_on_wifi_only" value="true" />
<string name="system_release">4.1.1</string>
<boolean name="pref_camera_first_use_hint_shown_key" value="false" />
<int name="cache-up-to-date" value="1" /> ** tried changing this **
<int name="editor-update-video/*" value="312" />
<int name="external_storage_fsid" value="-1" />
<int name="picasasync.prefetch.clean-cache" value="0" />
<boolean name="has-editor-image/*" value="true" />
<string name="pref_camera_jpegquality_key">superfine</string>
<int name="pref_version_key" value="5" />
<boolean name="pref_video_first_use_hint_shown_key" value="false" />
<int name="packages-version" value="312" />
<boolean name="has-editor-video/*" value="false" />
</map>
API to older version of CacheService from 'cooliris' is here...
My question:
My app does 2 things:
inserts new Movies ( mimetype= video/* , file extension= .3gp ) into /mnt/sdcard/Movies
relies on 'refreshed' version of Gallery3D thumbnails in order to provide FULL sharing context to (G+, Youtube, etc )
THE ISSUE IS THAT THE Gallery CACHE WILL NOT REFRESH UNTIL A REBOOT
I am unable to figure out a way to get that thumbnail within the gallery app for the newly inserted Movie to show up within a resaonable interval after my app inserts the movie to the directory where movies are stored on the phone. I am not convinced that i need to implement my own cache. I just would like to find the interface or the preference toggle that would force the Gallery3D app to refresh its own cache. The cache refresh puts a thumb for the new movie into the normal gallery list. With the new Thumb from the refresh, the user has full social sharing menu for the new movie. Without a cache refresh, there is NO THUMBNAIL over in the Gallery app, and the local context menu for mime/type of the item in my app ( video/*, .3gp ) DOES NOT INCLUDE G+, youtube etc. See the pic below for desired state of the Gallery's action bar context menu AFTER a refresh. Note that prior to the refresh, G+ and Youtube are not in a context menu for the movie item in my app, and the Thumb for the item is NOT yet in the gallery app. Its frustrating because if you just wait long enough, the thumb always shows up over in the Gallery app.
Ive tried toggling Google account data settings for SYNC.
Ive tried manual edit on the gallery preference for "cache-up-to-date" setting it to false.
I have NOT tried to request an intent for the Gallery3D.CacheService from my third party app. That would be something like...
Intent i = new Intent();
i.setClassName("CacheService", "com.google.android.cache.CacheService"); (pkg , class)
startService(i);
But, i dont have the exact class name for the implementation, so i can not be sure of requesting that service.intent from my app, and i don't think that i see it in the logcat when i browse there after a reboot? I could logcat the cooliris source version of the app, but i dont think that is much good at this point because JB has refactored com.google.android version.
Desired Context w/ G+, Youtube, full social, from the thumbnail after reboot/refresh...
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/waOFIm899II
asked wrong question..
should have asked "how to force a media rescan"