Audio Recorder in Android With Example
Audio Recorder in Android With Example
strings.xml file.
<resources>
<string name="app_name">GFG APP</string>
<string name="toggle_flash">Toggle Flash</string>
<string name="action_settings">Settings</string>
<string name="scanned_data">Scanned Data</string>
<string name="audio_recorder">Audio Recorder</string>
<string name="start_recording">Start Recording</string>
<string name="stop_recording">Stop Recording</string>
<string name="play_recording">Play Recording</string>
<string name="stop_playing">Stop Playing</string>
<string name="status">Status</string>
</resources>
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[]
grantResults) {
// this method is called when user will
// grant the permission for audio recording.
switch (requestCode) {
case REQUEST_AUDIO_PERMISSION_CODE:
if (grantResults.length > 0) {
boolean permissionToRecord = grantResults[0] ==
PackageManager.PERMISSION_GRANTED;
boolean permissionToStore = grantResults[1] ==
PackageManager.PERMISSION_GRANTED;
if (permissionToRecord && permissionToStore) {
Toast.makeText(getApplicationContext(), "Permission
Granted", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Permission
Denied", Toast.LENGTH_LONG).show();
}
}
break;
}
}