更新时间:2022-05-27 22:36:33
我在网上寻找解决方案并发现了一些问题
I looked for a solution online and found something
private class MusicIntentReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
int state = intent.getIntExtra("state", -1);
switch (state) {
case 0:
audioManager.setSpeakerphoneOn(true);
break;
case 1:
audioManager.setSpeakerphoneOn(false);
break;
default:
audioManager.setSpeakerphoneOn(true);
}
}
}
}
希望有帮助
如果您想访问该网站,请点击链接href ="https://github.com/twilio/video-quickstart-android/issues/76" rel ="nofollow noreferrer">链接
If you want to visit the site , here is the link