parent
30eff93fa1
commit
59401e18ed
1 changed files with 8 additions and 4 deletions
|
@ -243,13 +243,17 @@ public abstract class AudioManagerCompat {
|
|||
Log.w(TAG, "Trying again to request audio focus");
|
||||
}
|
||||
|
||||
try {
|
||||
int result = audioManager.requestAudioFocus(audioFocusRequest);
|
||||
|
||||
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||
Log.w(TAG, "Audio focus not granted. Result code: " + result);
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (SecurityException ex) {
|
||||
Log.w(TAG, "Encountered security exception when requesting audio focus.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue