Impossível criar arquivo no armazenamento externo Android

Quero criar um arquivo .txt e armazená-lo no armazenamento externo do telefone Android. Eu adicionei a permissão ao meu manifesto do Android. Quando executo o código, não ocorre nenhum erro, mas o arquivo nunca é criado. Não tenho certeza do que estou fazendo de errado.

public void createExternalStoragePrivateFile(String data) {
    // Create a path where we will place our private file on external
    // storage.
    File file = new File(myContext.getExternalFilesDir(null), "state.txt");

    try {

        FileOutputStream os = null; 
        OutputStreamWriter out = null;
        os = myContext.openFileOutput(data, Context.MODE_PRIVATE);
        out = new OutputStreamWriter(os);
        out.write(data);
        os.close();

        if(hasExternalStoragePrivateFile()) {
            Log.w("ExternalStorageFileCreation", "File Created");
        } else {
            Log.w("ExternalStorageFileCreation", "File Not Created");
        }

    } catch (IOException e) {
        // Unable to create file, likely because external storage is
        // not currently mounted.
        Log.w("ExternalStorage", "Error writing " + file, e);
    }
}

questionAnswers(3)

yourAnswerToTheQuestion