Пробовал два способа:
File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), "AppDir");
или
File sdCard = Environment.getExternalStorageDirectory();
File mediaStorageDir = new File(sdCard.getAbsolutePath() + "/AppDir");
но в обоих случаях видео записывается во внутреннюю память.
mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_"+ timeStamp + ".mp4");
Пермишены:
@AfterPermissionGranted(RC_CAMERA_AND_LOCATION)
private void methodRequiresTwoPermission() {
String[] perms = {
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE;
if (EasyPermissions.hasPermissions(getContext(), perms)) {
Log.d("PERMISSIONS", "All right");
initService();
} else {
EasyPermissions.requestPermissions(this, "Need perms", RC_CAMERA_AND_LOCATION, perms);
}
}