本文整理汇总了Java中android.media.AudioManager.isSpeakerphoneOn方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.isSpeakerphoneOn方法的具体用法?Java AudioManager.isSpeakerphoneOn怎么用?Java AudioManager.isSpeakerphoneOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.isSpeakerphoneOn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleWiredHeadsetChange
import android.media.AudioManager; //导入方法依赖的package包/类
private void handleWiredHeadsetChange(Intent intent) {
Log.w(TAG, "handleWiredHeadsetChange...");
if (callState == CallState.STATE_CONNECTED ||
callState == CallState.STATE_DIALING ||
callState == CallState.STATE_REMOTE_RINGING)
{
AudioManager audioManager = ServiceUtil.getAudioManager(this);
boolean present = intent.getBooleanExtra(EXTRA_AVAILABLE, false);
if (present && audioManager.isSpeakerphoneOn()) {
audioManager.setSpeakerphoneOn(false);
audioManager.setBluetoothScoOn(false);
} else if (!present && !audioManager.isSpeakerphoneOn() && !audioManager.isBluetoothScoOn() && localVideoEnabled) {
audioManager.setSpeakerphoneOn(true);
}
if (recipient != null) {
sendMessage(viewModelStateFor(callState), recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
}
}
示例2: updateAudioState
import android.media.AudioManager; //导入方法依赖的package包/类
public void updateAudioState(boolean isBluetoothAvailable) {
AudioManager audioManager = ServiceUtil.getAudioManager(getContext());
if (!isBluetoothAvailable) {
bluetoothButton.setVisibility(View.GONE);
} else {
bluetoothButton.setVisibility(View.VISIBLE);
}
if (audioManager.isBluetoothScoOn()) {
bluetoothButton.setChecked(true);
speakerButton.setChecked(false);
} else if (audioManager.isSpeakerphoneOn()) {
speakerButton.setChecked(true);
bluetoothButton.setChecked(false);
} else {
speakerButton.setChecked(false);
bluetoothButton.setChecked(false);
}
}
示例3: handleWiredHeadsetChange
import android.media.AudioManager; //导入方法依赖的package包/类
private void handleWiredHeadsetChange(Intent intent) {
Log.w(TAG, "handleWiredHeadsetChange...");
if (callState == CallState.STATE_CONNECTED ||
callState == CallState.STATE_DIALING ||
callState == CallState.STATE_REMOTE_RINGING)
{
AudioManager audioManager = ServiceUtil.getAudioManager(this);
boolean present = intent.getBooleanExtra(EXTRA_AVAILABLE, false);
if (present && audioManager.isSpeakerphoneOn()) {
audioManager.setSpeakerphoneOn(false);
audioManager.setBluetoothScoOn(false);
} else if (!present && !audioManager.isSpeakerphoneOn() && !audioManager.isBluetoothScoOn() && localVideoEnabled) {
audioManager.setSpeakerphoneOn(true);
}
if (recipient != null) {
sendMessage(viewModelStateFor(callState), recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
}
}
示例4: updateAudioState
import android.media.AudioManager; //导入方法依赖的package包/类
public void updateAudioState(boolean isBluetoothAvailable) {
AudioManager audioManager = ServiceUtil.getAudioManager(getContext());
if (!isBluetoothAvailable) {
bluetoothButton.setVisibility(View.GONE);
} else {
bluetoothButton.setVisibility(View.VISIBLE);
}
if (audioManager.isBluetoothScoOn()) {
bluetoothButton.setChecked(true, false);
speakerButton.setChecked(false, false);
} else if (audioManager.isSpeakerphoneOn()) {
speakerButton.setChecked(true, false);
bluetoothButton.setChecked(false, false);
} else {
speakerButton.setChecked(false, false);
bluetoothButton.setChecked(false, false);
}
}
示例5: handleSetMuteVideo
import android.media.AudioManager; //导入方法依赖的package包/类
private void handleSetMuteVideo(Intent intent) {
AudioManager audioManager = ServiceUtil.getAudioManager(this);
boolean muted = intent.getBooleanExtra(EXTRA_MUTE, false);
this.localVideoEnabled = !muted;
if (this.peerConnection != null) {
this.peerConnection.setVideoEnabled(this.localVideoEnabled);
}
if (this.callId != null && this.dataChannel != null) {
this.dataChannel.send(new DataChannel.Buffer(ByteBuffer.wrap(Data.newBuilder()
.setVideoStreamingStatus(WebRtcDataProtos.VideoStreamingStatus.newBuilder()
.setId(this.callId)
.setEnabled(localVideoEnabled))
.build().toByteArray()), false));
}
if (callState == CallState.STATE_CONNECTED) {
if (localVideoEnabled) this.lockManager.updatePhoneState(LockManager.PhoneState.IN_VIDEO);
else this.lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
}
if (localVideoEnabled && !audioManager.isSpeakerphoneOn() && !audioManager.isBluetoothScoOn()) {
audioManager.setSpeakerphoneOn(true);
}
sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
示例6: obtainAudioType
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public String obtainAudioType(Context context) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (audioManager.isSpeakerphoneOn()) {
return SPEAKER;
} else {
return chain.obtainAudioType(context);
}
}
示例7: isOpenSpeaker
import android.media.AudioManager; //导入方法依赖的package包/类
/**
* 获取扬声器是否开启
* @param context
* @return true:已打开,false:已关闭
*/
public static boolean isOpenSpeaker(Context context) {
try {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
return audioManager.isSpeakerphoneOn();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例8: handleSetMuteVideo
import android.media.AudioManager; //导入方法依赖的package包/类
private void handleSetMuteVideo(Intent intent) {
AudioManager audioManager = ServiceUtil.getAudioManager(this);
boolean muted = intent.getBooleanExtra(EXTRA_MUTE, false);
this.localVideoEnabled = !muted;
if (this.peerConnection != null) {
this.peerConnection.setVideoEnabled(this.localVideoEnabled);
}
if (this.callId != null && this.dataChannel != null) {
this.dataChannel.send(new DataChannel.Buffer(ByteBuffer.wrap(Data.newBuilder()
.setVideoStreamingStatus(WebRtcDataProtos.VideoStreamingStatus.newBuilder()
.setId(this.callId)
.setEnabled(localVideoEnabled))
.build().toByteArray()), false));
}
if (callState == CallState.STATE_CONNECTED) {
if (localVideoEnabled) this.lockManager.updatePhoneState(LockManager.PhoneState.IN_VIDEO);
else this.lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
}
if (localVideoEnabled &&
!audioManager.isSpeakerphoneOn() &&
!audioManager.isBluetoothScoOn() &&
!audioManager.isWiredHeadsetOn())
{
audioManager.setSpeakerphoneOn(true);
}
sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
示例9: lavKontaktinfo
import android.media.AudioManager; //导入方法依赖的package包/类
public static String lavKontaktinfo() {
String ret = "";
try {
/*
for (String afprøvet : afprøvedeTing.keySet()) {
ret += "\n" + afprøvet + ": " + afprøvedeTing.get(afprøvet);
}
ret += "\nOvenstående er korrekt: JA/NEJ\n\n";
PackageManager pm = instans.getPackageManager();
String version;
try {
PackageInfo pi = pm.getPackageInfo(instans.getPackageName(), 0);
version = pi.versionName;
} catch (Exception e) {
version = e.toString();
e.printStackTrace();
}
ret += instans.getPackageName() + " (v " + version + ")" + "\nTelefonmodel: " + Build.MODEL + " " + Build.PRODUCT + "\nAndroid v" + Build.VERSION.RELEASE + " (sdk: " + Build.VERSION.SDK + ")";
*/
AudioManager am = (AudioManager) ApplicationSingleton.instans.getSystemService(Context.AUDIO_SERVICE);
LinkedHashSet<String> udgange = new LinkedHashSet<>();
if (am.isBluetoothA2dpOn()) udgange.add("BluetoothA2dp");
if (am.isBluetoothScoOn()) udgange.add("BluetoothSco");
if (am.isSpeakerphoneOn()) udgange.add("Speakerphone");
if (am.isWiredHeadsetOn()) udgange.add("(Kablede høretelefoner forbundne)");
ret += "\nVersion: "+App.versionsnavn +
"\nTelefonmodel: " + Build.MODEL + " " + Build.PRODUCT +
"\nAndroid v" + Build.VERSION.RELEASE + " (sdk: " + Build.VERSION.SDK_INT + ")";
ret += "\nFunktioner brugt: "+ Sidevisning.getViste();
// ret += "\nFunktioner ej brugt: "+ Sidevisning.getIkkeViste();
ret += "\nIndstillinger: "+ App.prefs.getAll();
ret += "\nAfspiller: "+ App.afspiller.toString();
ret += "\nUdgange: "+ udgange;
} catch (Exception e) {
Log.rapporterFejl(e);
}
return ret;
}