i use the below code to create file in android but the files are not created when i use android version 4.x but when i use version like 2.x the code working fine and the files are created
File path = new File( Environment.getExternalStorageDirectory()+"/FullDuplexCall/");
path.mkdirs();
try {
sendfile = File.createTempFile("sendfile", ".txt",path);
Log.d("VS", "create sender file");
recfile=File.createTempFile("recfile",".txt",path);
Log.d("VS", "create reciever file");
dos = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(sendfile)));
dos1 = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(recfile)));
} catch (IOException e) {
throw new RuntimeException("Couldn't create file on SD card", e);
}
and here is the permission
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"> </uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"> </uses-permission>