![]() ![]()
To implement the Audio focus in the application same as discussed above invoke the following code in the MainActivity.java file.AUDIOFOCUS_LOSS: if there is permanent loss of the audio then the mediaplayer should be released (completely stopped).AUDIOFOCUS_LOSS_TRANSIENT: if there is temporary loss of audio focus then the playback of the audio should be paused.AUDIOFOCUS_GAIN: if the system grants the audio focus gain, then the playback can be continued after the temporary loss of the audio focus.The focus request result which is returned by the Android system is compared to the following constants. ![]() When the call gets hanged up the focus changes to the current application and MediaPlayer is resumed.Meaning the system has transferred the audio focus to another service that is used by the app, in this case, the Phone application which takes the audio focus from the current application which is playing the audio.ĪudioManager.OnAudioFocusChangeListener audioFocusChangeListener -> This handles if there is change in the audio focus which the callback need to implemented according to the focus change from the audio manage. The main Callback needs to implemented when there is a change in the Audio focus.Step 3: Working with the MainActivity.java file External Storage in Android with Example.Firebase Authentication with Phone Number OTP in Android. HOW TO SOLVE UNABLE TO LOCATE ADB IN ANDROID STUDIO 3.0.1 HOW TO
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |