android-mediascanner

Android Newly Taken Photo from custom camera does not appear in gallery (media store)

非 Y 不嫁゛ 提交于 2019-12-02 10:45:19
问题 in my app, i initially load all the images from the gallery, i.e. (MediaStore.Images.Media.EXTERNAL_CONTENT_URI) user can take picture via my app, but i have a custom camera, i.e. i do not use default phone camera to take pictures, i have my own surface view, i deal with Camera object directly, and handle the camera picture. and i save this image in a custom folder. i want the newly taken picture to appear in my gallery once user returns to my app problem: the newly taken picture does not

Android Newly Taken Photo from custom camera does not appear in gallery (media store)

亡梦爱人 提交于 2019-12-02 02:53:53
in my app, i initially load all the images from the gallery, i.e. (MediaStore.Images.Media.EXTERNAL_CONTENT_URI) user can take picture via my app, but i have a custom camera, i.e. i do not use default phone camera to take pictures, i have my own surface view, i deal with Camera object directly, and handle the camera picture. and i save this image in a custom folder. i want the newly taken picture to appear in my gallery once user returns to my app problem: the newly taken picture does not appear in the cursor i loaded with MediaStore.Images.Media.EXTERNAL_CONTENT_URI the problem is gone only

Android : Get recently added media in Android Device similarly to File Manager

半腔热情 提交于 2019-11-30 16:13:23
I am working on an application in which I have to notify user as soon as a new image, video, audio or apk is inserted by the user by any means (whether he downloads it or transfer it),similar to what File Manager application do.I don't know where to start from. Thanks Here is my complete code to notify user when a new media (image, audio or video) is added into the device. It might help someone.Also, I am displaying push notifications as soon as new media is added. EDITED (issues resolved are below) 1.Notify user only when media is added,not deleted. public class MediaTrackerService extends

Android : Get recently added media in Android Device similarly to File Manager

自闭症网瘾萝莉.ら 提交于 2019-11-30 16:09:58
问题 I am working on an application in which I have to notify user as soon as a new image, video, audio or apk is inserted by the user by any means (whether he downloads it or transfer it),similar to what File Manager application do.I don't know where to start from. Thanks 回答1: Here is my complete code to notify user when a new media (image, audio or video) is added into the device. It might help someone.Also, I am displaying push notifications as soon as new media is added. EDITED (issues

Captured image was not showing in gallery but it stored successfully in sdcard

元气小坏坏 提交于 2019-11-30 05:17:11
问题 I am new to android development, i am doing small application to capture USB Camrea image using UVCCamera . I have captured image using UVCCamera and stored in sdcard like this File filepath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "IMG_"+getDateTime() + ".jpg"); mCameraClient.captureStill(filepath.toString()); here mCameraClient will intract with UVC Camera and capture image and store in that path and it will callback method onCaptureDone

File not added to gallery android

寵の児 提交于 2019-11-29 11:59:31
This app i am making is taking pictures and saving it to sdcard but the images are not being shown in gallery...Is there something wrong with my code public void takepicture(View view){ try{ String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { //To store public files File directory=new File(Environment.getExternalStorageDirectory() , "Myapp Pictures"); if(!directory.exists()) directory.mkdir(); // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "Img" + timeStamp + "

MediaScannerConnection#scanFile converts directories into files when accessing them with USB-MTP on Android 5 Lollipop

久未见 提交于 2019-11-29 10:31:53
Changes like renaming a file triggered by an app only appear to the USB-MTP interface after reboot of the Android device or after you registered the new file at the MediaScanner them like this (see Trigger mediascanner on specific path (folder), how to? ): file.renameTo(newFile); MediaScannerConnection.scanFile(context, new String[] { newFile.getAbsolutePath() }, null, null); USB-MTP is used to access the storage of an android device via USB. E.g. with the Windows Explorer. However, with the Sony XPERIA Tablet Z (SGP321) under Android 5.0.2 (Build 10.6.A.0.454) folders supplied in newFile will

update android image gallery with newly created bitmap

两盒软妹~` 提交于 2019-11-29 05:12:29
I'm trying to save an image file to external storage. I can save the picture to the sdcard but it doesn't show up in Androids gallery application. I've tried this approach: File path = Environment.getExternalStorageDirectory(); File f = new File(path + "/mydirectory/" + imageName + "_" + System.currentTimeMillis() + ".jpg"); FileOutputStream fos = new FileOutputStream(f); f.mkdirs(); b.compress(CompressFormat.JPEG, 100, fos); fos.close(); Uri contentUri = Uri.fromFile(f); Intent mediaScanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE"); mediaScanIntent.setData(contentUri);

How To Add Media To MediaStore on Android 4.4 KitKat SD Card With Metadata

六眼飞鱼酱① 提交于 2019-11-28 22:01:51
Background: In Android 4.4, Google decided that apps should not have write access to SD cards . However, apps can write to /SDCard/Android/data/App Package Name. So this is what I've done. I have written an MP3 file to /Android/data/. I then want this MP3 file to show up in Android music players. I've tried the following... sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + filePath))); and.... MediaScannerConnection.scanFile(this, new String[] { file.toString() }, new String[] {"audio/*"}, new MediaScannerConnection.OnScanCompletedListener() { public void

Android's Media Scanner: How do I remove files?

好久不见. 提交于 2019-11-28 06:36:45
I'm writing an app that removes files that may or may not be listed in any one of the types of media libraries such as music or pictures. While I can use the MediaScannerConnection.scanFile method to add files to the media library there doesn't seem to be any call to notify the service that the file has been removed. Sending it the path of the file that no longer exists doesn't result in the desired behavior either. How should I go about removing items from the library that no longer exist on the Android storage? The following works well for me. You can delete or add files using this.