本文整理汇总了Java中android.media.AudioManager.isBluetoothA2dpOn方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.isBluetoothA2dpOn方法的具体用法?Java AudioManager.isBluetoothA2dpOn怎么用?Java AudioManager.isBluetoothA2dpOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.isBluetoothA2dpOn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBluetoothAvailable
import android.media.AudioManager; //导入方法依赖的package包/类
private boolean isBluetoothAvailable() {
try {
synchronized (LOCK) {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled()) return false;
if (!audioManager.isBluetoothScoAvailableOffCall()) return false;
if (Build.VERSION.SDK_INT >= 11) {
return bluetoothHeadset != null && !bluetoothHeadset.getConnectedDevices().isEmpty();
} else {
return audioManager.isBluetoothScoOn() || audioManager.isBluetoothA2dpOn();
}
}
} catch (Exception e) {
Log.w(TAG, e);
return false;
}
}
示例2: execute
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void execute(AudioManager audioManager) {
if (voiceMediator.isBlueToothHeadSet()) {
if (!voiceMediator.isSuportA2DP()) {
if (audioManager.getMode() != AudioManager.MODE_NORMAL) {
Log.e(TAG, "playInChannel>>setMode(AudioManager.MODE_NORMAL)");
audioManager.setMode(AudioManager.MODE_NORMAL);
}
if (audioManager.isBluetoothScoOn()) {
audioManager.setBluetoothScoOn(false);
audioManager.stopBluetoothSco();
}
} else {
if (!audioManager.isBluetoothA2dpOn()) {
Log.e(TAG, "playInChannel>>setBluetoothA2dpOn(true)");
audioManager.setBluetoothA2dpOn(true);
}
}
}
}
示例3: isBluetoothAvailable
import android.media.AudioManager; //导入方法依赖的package包/类
private boolean isBluetoothAvailable() {
try {
synchronized (LOCK) {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled()) return false;
if (!audioManager.isBluetoothScoAvailableOffCall()) return false;
if (Build.VERSION.SDK_INT >= 11) {
return bluetoothHeadset != null && !bluetoothHeadset.getConnectedDevices().isEmpty();
} else {
return audioManager.isBluetoothScoOn() || audioManager.isBluetoothA2dpOn();
}
}
} catch (Exception e) {
Log.w(TAG, e);
return false;
}
}
示例4: 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;
}