Ejemplo n.º 1
0
        public static void requestAudioFocus(VrActivity act)
        {
            AudioManager audioManager = (AudioManager)act.getSystemService(Context.AUDIO_SERVICE);

            // Request audio focus
            int result = audioManager.requestAudioFocus(act, AudioManager.STREAM_MUSIC,
                                                        AudioManager.AUDIOFOCUS_GAIN);

            if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
            {
                Log.d(TAG, "requestAudioFocus(): GRANTED audio focus");
            }
            else if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED)
            {
                Log.d(TAG, "requestAudioFocus(): FAILED to gain audio focus");
            }
        }
Ejemplo n.º 2
0
        public static void releaseAudioFocus(VrActivity act)
        {
            AudioManager audioManager = (AudioManager)act.getSystemService(Context.AUDIO_SERVICE);

            audioManager.abandonAudioFocus(act);
        }
Ejemplo n.º 3
0
 public static void releaseAudioFocus(VrActivity act)
 {
     AudioManager audioManager = (AudioManager)act.getSystemService(Context.AUDIO_SERVICE);
     audioManager.abandonAudioFocus(act);
 }
Ejemplo n.º 4
0
        public static void requestAudioFocus(VrActivity act)
        {

            AudioManager audioManager = (AudioManager)act.getSystemService(Context.AUDIO_SERVICE);

            // Request audio focus
            int result = audioManager.requestAudioFocus(act, AudioManager.STREAM_MUSIC,
                AudioManager.AUDIOFOCUS_GAIN);
            if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
            {
                Log.d(TAG, "requestAudioFocus(): GRANTED audio focus");
            }
            else if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED)
            {
                Log.d(TAG, "requestAudioFocus(): FAILED to gain audio focus");
            }
        }