(通过说接收器,我指的是您正常听到电话时的声音。)
有人给了下面的代码,这是行不通的。有什么帮助吗?
Object obj = new Object();
Method method;
try {
method = Class.forName("android.media.AudioSystem").getMethod(
"setDeviceConnectionState", new Class[] { Integer.TYPE,Integer.TYPE,
String.class });
method.invoke(obj, new Object[] {num,1,""});
} catch (Exception e) {
e.printStackTrace();
Log.i(TAG, e.toString());
}
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
String type = getMIMEType(f);
intent.setDataAndType(Uri.fromFile(f), type);
startActivity(intent);
最佳答案
m_amAudioManager.setMode(AudioManager.MODE_IN_CALL);
关于android - 如何让音乐从接收器而不是扬声器播放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4363832/