AudioManager isSpeakerphoneOn - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AudioManager isSpeakerphoneOn method.

This code example shows how to use the following methods:isSpeakerphoneOn, setSpeakerphoneOn, setWiredHeadsetOn
        return mAudioMode == AudioMode.DEVICE;
    } 
 
    public boolean isSpeakerOn() 
    { 
        Log.d( TAG, " - isSpeakerphoneOn: " + mAudioManager.isSpeakerphoneOn() );
        return mAudioManager.isSpeakerphoneOn();
    } 
 
    public void toggleSpeaker() 
    { 
        if ( isSpeakerOn() ) 
        { 
            turnOnHeadset(); 
        } 
        else 
        { 
            turnOnSpeaker(); 
        } 
    } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:isSpeakerphoneOn
 */ 
public class PhoneUtils { 
 
  public static boolean isSpeakerOn(Context context) {
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    return audioManager.isSpeakerphoneOn();
  } 
 
  /** 
   * @return true if the Bluetooth on/off switch in the UI should be 
   *         available to the user (i.e. if the device is BT-capable 
   *         and a headset is connected.) 
   */ 
  public static boolean isBluetoothAvailable() { 
    return false; //TODO: Stuart O. Anderson 
  } 
 
  public static boolean isBluetoothAudioConnectedOrPending() { 
    return false; //TODO: Stuart O. Anderson 
  } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:isBluetoothA2dpOn, isBluetoothScoAvailableOffCall, isBluetoothScoOn, isMicrophoneMute, isMusicActive
		 
		Log.v(TAG, "calling " + intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER));
		 
		AudioManager audM = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
		 
		Log.v(TAG, "isBluetoothA2dpOn : " + audM.isBluetoothA2dpOn());
		Log.v(TAG, "isBluetoothScoAvailableOffCall : " + audM.isBluetoothScoAvailableOffCall());
		Log.v(TAG, "isBluetoothScoOn : " + audM.isBluetoothScoOn());
		Log.v(TAG, "isMicrophoneMute : " + audM.isMicrophoneMute());
		Log.v(TAG, "isMusicActive : " + audM.isMusicActive());
		Log.v(TAG, "isSpeakerphoneOn : " + audM.isSpeakerphoneOn());
		Log.v(TAG, "isWiredHeadsetOn : " + audM.isWiredHeadsetOn());
 
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:isSpeakerphoneOn
    public void registerHeadsetReceiver() { 
        if (mReceiver != null) {
            return; 
        } 
 
        mOriginalSpeakerStatus = mAudioManager.isSpeakerphoneOn();
        IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
 
        mReceiver = new BroadcastReceiver() {
            @Override 
            public void onReceive(Context context, Intent intent) {
                if (Intent.ACTION_HEADSET_PLUG.equals(intent.getAction())) {
                    try { 
                        mAudioManager.setSpeakerphoneOn(
                                intent.getIntExtra("state", 0) == 0);
                    } catch (SecurityException e) {
                        Log.e(TAG, "setMode exception: " + e.getMessage());
                        logDeviceInfo(); 
                    } 
                } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:isSpeakerphoneOn
			Log.d("VCDA","SpeakerOff");
		} 
	} 
	 
	public boolean speakerActive(){ 
		return audioManager.isSpeakerphoneOn();
	} 
	 
	public void setActivate(boolean act){
		this.activate = act;
	} 
	 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
isSpeakerphoneOn Method Overview
Checks whether the speakerphone is on or off.
See Code Examples for other Android AudioManager Methods: