android - MediaStore managedQuery not returning the newest files -


i querying mediastore videos based on duration of (max 15 seconds).

the problem facing when record video using gallery. then, if go app, video not show in cursor. however, if go gallery , open video, returned next time query.

here query:

private cursor getvideos() {         _.log("getvideos");         string[] proj = { mediastore.video.media._id,                 mediastore.video.media.data,                 mediastore.video.media.display_name,                 mediastore.video.media.size, mediastore.video.media.date_taken,                 mediastore.video.media.duration };          return managedquery(mediastore.video.media.external_content_uri, proj,                 mediastore.video.media.duration + "<=?" + " , "                         + mediastore.video.media.duration + ">=?" + " , "                         + mediastore.video.media.size + ">=?", new string[] {                         "15000", "1000", "1000" }, null);     } 

possible solution force refresh before querying. tried using following code utilizes mediascannerconnection:

_.log("new mediascannerconnection"); msc = new mediascannerconnection(mcontext, new mediascannerconnectionclient() {      public void onscancompleted(string path, uri uri) {         _.log("onscancompleted:"+path);         msc.disconnect();         synchronized (lock) {             lock.notifyall();         }     }      public void onmediascannerconnected() {         _.log("onmediascannerconnected:" + mediastore.video.media.external_content_uri.tostring());         msc.scanfile(mediastore.video.media.external_content_uri.getpath(),                 null);     } }); _.log("connect"); msc.connect(); synchronized (lock) {     try {         _.log("waiting");         lock.wait();     } catch (interruptedexception e) {         e.printstacktrace();     }     _.log("done waiting"); } 

however did not solve problem. on phones, getting onmediascannerconnected called multiple times , never onscancompleted


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -