1. Download our Official Android App: Forums for Android!

Mods Forcing notifications audio to loudspeaker programmatically when headphones in. [Root only]

Discussion in 'Android Development' started by califauna, Jan 25, 2014.

  1. califauna

    califauna Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    20
    Joined:
    Jan 23, 2014

    Jan 23, 2014
    20
    2
    36
    Hi,

    How I might go about forcing notification audio to the loudspeaker programatically when the headphones are plugged in?

    Are there any commands that can be run in a shell like that available in the security settings plugin which could do this, or saved as a file and then run by tasker?

    It seems this class in the Android APIs would be for that: AudioManager | Android Developers

    Id like to know though if there's a way to do it without having to develop an app or get in so deep (though the SDK there does look really impressive and beginner friendly)

    The problem is that the alarm cant be heard in the morning when the headphones are left in, or an external speaker attached (which switches itself off in the night when the music stops playing)

    Phone is i9100 and ROMs are custom ROMs (now trying out RR Kit Kat).

    Thanks.

    Note:

    Tasker and Sound Around kind of works, but only if you force basically everything including media sounds through the speaker. Also Im finding that the Alarm is not recognised by tasker on my phone unless its by the %WIN variable, so Sound Around is loaded automatically by tasker in response to the alarm window. This means that when Sound Around is closed to get at the alarm it is instantly reloaded again by tasker, so you cant get to the alarm screen. Maybe theres a way around that but I dont see any way for the audio routing problem so far so looking for a manual solution with a script or some kind or command.
     

    Advertisement

  2. Rukbat

    Rukbat Android Expert
    Rank:
    None
    Points:
    843
    Posts:
    10,392
    Joined:
    Jan 16, 2012

    Jan 16, 2012
    10,392
    2,894
    843
    Male
    Being retired and writing Tasker tasks.
    Fayetteville, NC, USA
    In most phones, when you plug a plug into the headphone jack, the speakers are physically disconnected in hardware. You'd have to add a function in Android to send a signal to a relay which would reconnect the speakers when you want speaker output with a plug in the jack. (And you'd have to add the relay.)
     
  3. califauna

    califauna Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    20
    Joined:
    Jan 23, 2014

    Jan 23, 2014
    20
    2
    36
    Thanks for the suggestion, but that cant be the case with my phone (i9100). The app called Sound About can already direct sound to the speakers with the headphones in, but it isnt a good solution (problems described above).
     
  4. califauna

    califauna Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    20
    Joined:
    Jan 23, 2014

    Jan 23, 2014
    20
    2
    36
    any takers?
     

Share This Page

Loading...