private static String getFileNameForContent(Uri uri, Context context) {
        ContentResolver contentResolver = context.getContentResolver();
        Cursor cursor = contentResolver.query(uri, null, null, null, null);

        String fileName = uri.getLastPathSegment();
        try {
            if (cursor.moveToFirst()) {
                int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
                fileName = cursor.getString(nameIndex);
            }
        } finally {
            cursor.close();
        }
        return fileName;
    }
Verifies the content typs of a file URI. A helper function
for isVideoType and isImageType

@param contentMimeType - "video/" or "image/"
@param uri             - file uri
@param context         - react context
@return a boolean to determine if file is of specified content type i.e. image or video
android/src/main/java/com/imagepicker/Utils.java