本文整理汇总了Java中android.media.AudioManager.isWiredHeadsetOn方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.isWiredHeadsetOn方法的具体用法?Java AudioManager.isWiredHeadsetOn怎么用?Java AudioManager.isWiredHeadsetOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.isWiredHeadsetOn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startIncomingRinger
import android.media.AudioManager; //导入方法依赖的package包/类
public void startIncomingRinger() {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
boolean speaker = !audioManager.isWiredHeadsetOn() && !audioManager.isBluetoothScoOn();
audioManager.setMode(AudioManager.MODE_RINGTONE);
audioManager.setMicrophoneMute(false);
audioManager.setSpeakerphoneOn(speaker);
incomingRinger.start();
}
示例2: startIncomingRinger
import android.media.AudioManager; //导入方法依赖的package包/类
public void startIncomingRinger() {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
boolean speaker = !audioManager.isWiredHeadsetOn() && !audioManager.isBluetoothScoOn();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
} else {
audioManager.setMode(AudioManager.MODE_IN_CALL);
}
audioManager.setMicrophoneMute(false);
audioManager.setSpeakerphoneOn(speaker);
incomingRinger.start(speaker);
}
示例3: obtainAudioType
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public String obtainAudioType(Context context) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (audioManager.isWiredHeadsetOn()) {
return HEADPHONES;
} else {
return chain.obtainAudioType(context);
}
}
示例4: onCallConnected
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void onCallConnected(RongCallSession callSession, SurfaceView localVideo) {
super.onCallConnected(callSession, localVideo);
this.callSession = callSession;
TextView remindInfo = (TextView) mUserInfoContainer.findViewById(R.id.rc_voip_call_remind_info);
setupTime(remindInfo);
if (callSession.getMediaType().equals(RongCallCommon.CallMediaType.AUDIO)) {
findViewById(R.id.rc_voip_call_minimize).setVisibility(View.VISIBLE);
FrameLayout btnLayout = (FrameLayout) inflater.inflate(R.layout.rc_voip_call_bottom_connected_button_layout, null);
mButtonContainer.removeAllViews();
mButtonContainer.addView(btnLayout);
} else {
mLocalVideo = localVideo;
mLocalVideo.setTag(callSession.getSelfUserId());
}
RongCallClient.getInstance().setEnableLocalAudio(!muted);
View muteV = mButtonContainer.findViewById(R.id.rc_voip_call_mute);
if (muteV != null) {
muteV.setSelected(muted);
}
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
if (audioManager.isWiredHeadsetOn()) {
RongCallClient.getInstance().setEnableSpeakerphone(false);
} else {
RongCallClient.getInstance().setEnableSpeakerphone(handFree);
}
View handFreeV = mButtonContainer.findViewById(R.id.rc_voip_handfree);
if (handFreeV != null) {
handFreeV.setSelected(handFree);
}
stopRing();
}
示例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.isWiredHeadsetOn())
{
audioManager.setSpeakerphoneOn(true);
}
sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
示例6: onCallConnected
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void onCallConnected(RongCallSession callSession, SurfaceView localVideo) {
super.onCallConnected(callSession, localVideo);
this.callSession = callSession;
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
if (audioManager.isWiredHeadsetOn()) {
RongCallClient.getInstance().setEnableSpeakerphone(false);
} else {
RongCallClient.getInstance().setEnableSpeakerphone(true);
}
if (localView == null) {
localView = localVideo;
localViewContainer.addView(localView, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
localViewUserId = RongIMClient.getInstance().getCurrentUserId();
localView.setTag(localViewUserId);
}
localViewContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isFullScreen) {
isFullScreen = true;
topContainer.setVisibility(View.GONE);
bottomButtonContainer.setVisibility(View.GONE);
} else {
isFullScreen = false;
topContainer.setVisibility(View.VISIBLE);
bottomButtonContainer.setVisibility(View.VISIBLE);
}
}
});
bottomButtonContainer.removeAllViews();
FrameLayout bottomButtonLayout = (FrameLayout) inflater.inflate(R.layout.rc_voip_multi_video_calling_bottom_view, null);
bottomButtonContainer.addView(bottomButtonLayout);
topContainer.setVisibility(View.VISIBLE);
minimizeButton.setVisibility(View.VISIBLE);
addButton.setVisibility(View.VISIBLE);
switchCameraButton.setVisibility(View.VISIBLE);
waitingContainer.setVisibility(View.GONE);
remoteViewContainer.setVisibility(View.VISIBLE);
participantPortraitContainer.setVisibility(View.GONE);
TextView remindInfo = (TextView) topContainer.findViewById(R.id.rc_voip_call_remind_info);
setupTime(remindInfo);
TextView userNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name);
String currentUserId = RongIMClient.getInstance().getCurrentUserId();
userNameView.setTag(currentUserId + "name");
UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(currentUserId);
if (userInfo != null) {
userNameView.setText(userInfo.getName());
} else {
userNameView.setText(currentUserId);
}
updateRemoteVideoViews(callSession);
}
示例7: isHeadsetPlugged
import android.media.AudioManager; //导入方法依赖的package包/类
public boolean isHeadsetPlugged() {
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
return audioManager.isWiredHeadsetOn();
}
示例8: 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;
}