I have created an app that opens camera and gallery, the detail is that it works on some devices, on another the app definitely stops.
private void openCamera() {
File file = new File(Environment.getExternalStorageDirectory(), MEDIA_DIRECTORY);
boolean isDirectoryCreated = file.exists();
if(!isDirectoryCreated)
isDirectoryCreated = file.mkdirs();
if(isDirectoryCreated){
Long timestamp = System.currentTimeMillis() / 1000;
String imageName = timestamp.toString() + ".jpg";
mPath = Environment.getExternalStorageDirectory() + File.separator + MEDIA_DIRECTORY
+ File.separator + imageName;
File newFile = new File(mPath);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(newFile));
startActivityForResult(intent, PHOTO_CODE);
}
}
the problem is with new generation devices
I've been seeing that on some devices I get this:
How can I delete it?