-1

My app allows users to take a picture with the camera and saves it to a custom folder. This works fine. The issue being seen by users (Samsung devices) is that the Gallery app crashes when launched. The only way to fix this is to go into Pictures folder on the device and remove the myApp custom directory.

Has anybody seen this issue before? I can paste the image creation/saving code if needed but that is working just fine.

Is this a permissions issue?

Could this be the issue?

1 Answers1

0

You can try update system according to system version:

        File mediaStorageDir = new File(getPictureDirectory());
        Uri contentUri = Uri.fromFile(mediaStorageDir);
        if(Build.VERSION.SDK_INT >= 19){
            Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
            mediaScanIntent.setData(contentUri);
            getApplication().sendBroadcast(mediaScanIntent);
        }else{
            getApplication().sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, contentUri));
        }

It works for me. Hope it help!

i_A_mok
  • 2,744
  • 2
  • 11
  • 15
  • Were you encountering a crash of the gallery app? Or is this solution to make sure the saved image appears in the gallery? @I_A_Mok – Nikhil Sohoni Aug 07 '16 at 23:52