当前位置: 首页>>代码示例>>Java>>正文


Java AudioManager.isWiredHeadsetOn方法代码示例

本文整理汇总了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();
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:11,代码来源:SignalAudioManager.java

示例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);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:SignalAudioManager.java

示例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);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-events-android,代码行数:10,代码来源:HeadphonesAudioType.java

示例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();
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:38,代码来源:SingleCallActivity.java

示例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);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:34,代码来源:WebRtcCallService.java

示例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);

}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:55,代码来源:MultiVideoCallActivity.java

示例7: isHeadsetPlugged

import android.media.AudioManager; //导入方法依赖的package包/类
public boolean isHeadsetPlugged() {
    AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
    return audioManager.isWiredHeadsetOn();
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:5,代码来源:PMedia.java

示例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;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:43,代码来源:Log.java


注:本文中的android.media.AudioManager.isWiredHeadsetOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。