AudioManager am = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
am.setMode(AudioManager.MODE_IN_CALL);
am.setSpeakerphoneOn(true);
And then play the sound through the AudioManager.STREAM_SYSTEM
stream.
When the sound's finished playing be sure to return the audio manager to its previous state or it'll stay on loudspeaker!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…