How to turn on speaker programmatically in android

android

Solution

audiomanager.setSpeakerphoneOn(true)

Be sure to include the `MODIFY_AUDIO_SETTINGS` permission in your manifest.

Problem

How to turn on speaker programmatically when incoming calls received and headphone attached on audio jack?

Original source