android-mediascanner

How to trigger MediaScan on Nexus 7?

可紊 提交于 2019-11-26 16:46:45
问题 Because I want to make sure the MediaStore has the latest information without having to reboot I'd like to trigger the MediaScanner using the popular way I found on SO context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); This works fine on my Samsung S2 w/ICS but not on my Nexus 7 w/JellyBean. Logcat shows this on my Nexus 7: WARN/ActivityManager(480): Permission denied: checkComponentPermission() owningUid=10014

Force scan files after taking photo

风流意气都作罢 提交于 2019-11-26 16:38:35
问题 on api level 4 (android 1.6), after taking photo using: Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File photo = new File(Environment.getExternalStorageDirectory(), "NewPic.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); imageUri = Uri.fromFile(photo); startActivityForResult(intent, TAKE_PICTURE); I'd like to look through all my photos thumbnails, but there is no my last photo thumbnail. It works perfectly on android 2.1. If I connect device via USB

Trigger mediascanner on specific path (folder), how to?

北城以北 提交于 2019-11-26 13:06:59
I got this class: import android.content.Context; import android.media.MediaScannerConnection; import android.net.Uri; import android.util.Log; public class MediaScannerWrapper implements MediaScannerConnection.MediaScannerConnectionClient { private MediaScannerConnection mConnection; private String mPath; private String mMimeType; // filePath - where to scan; // mime type of media to scan i.e. "image/jpeg". // use "*/*" for any media public MediaScannerWrapper(Context ctx, String filePath, String mime){ mPath = "/sdcard/DCIM/Camera"; mMimeType = "jpg"; mConnection = new MediaScannerConnection

Scan Android SD card for new files

耗尽温柔 提交于 2019-11-26 07:42:30
问题 My app allows a user to save an image to their SD card. But I\'m not sure how to make it appear in the gallery until you unmount and remount the SD card. I have googled for a couple of days with this problem but am not sure how to make it appear automatically. I found this link but I\'m not sure how to use the class. This is what i use to save the file. At the bottom of the try catch block is where I want to scan the sd card for new media. FileOutputStream outStream = null; File file = new

how to run media scanner in android

北慕城南 提交于 2019-11-26 06:38:28
问题 I want run the media scanner while capturing the image. After capturing, the image it is updated in grid view. For that I need to run media scanner. I found two solutions to run media scanner one is the broadcast event and other one is running media scanner class. I think in Ice Cream Sandwich (4.0) media scanner class is introduced.Before versions need to set broadcast event for running media scanner. can any one guide me how to run media scanner in right way. 回答1: I have found it best

Trigger mediascanner on specific path (folder), how to?

社会主义新天地 提交于 2019-11-26 03:38:55
问题 I got this class: import android.content.Context; import android.media.MediaScannerConnection; import android.net.Uri; import android.util.Log; public class MediaScannerWrapper implements MediaScannerConnection.MediaScannerConnectionClient { private MediaScannerConnection mConnection; private String mPath; private String mMimeType; // filePath - where to scan; // mime type of media to scan i.e. \"image/jpeg\". // use \"*/*\" for any media public MediaScannerWrapper(Context ctx, String