Is it possible to get the audio state ?
Like: Bluetooth, loudspeaker, earphone(the part that you put up to the ear) etc...
I know you can use this to set the state:
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
Log("Audio Target = " & r.Target)
Dim mode As Int
If Value Then mode = 0 Else mode = 2
r.RunMethod2("setMode", mode, "java.lang.int")
I tried, all I get is "0", No change if I switch to speaker, Bluetooth or earphone.
Code:
[Public Sub GetAudioMode() As Int]
[Dim r As Reflector]
[Dim mode As Int]
[ r.Target = r.GetContext]
[ r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")]
[ mode = r.RunMethod("getMode")]
[ Log("Audio mode = " & mode)]
[ Return mode]
[End Sub]
If I use: [r.RunMethod2("setMode", mode, "java.lang.int")]
then I get 0 or 2.
Is "audiomanager" library the exact name ?, looked for about 45 min, unable to find where to download.
I found audio library closest to name.
searching for a specific library is not as easy as it sounds on this forum.
Note that you should write code in the post like this
[ code ] (without the spaces here)
Public Sub GetAudioMode() As Int
Dim r As Reflector
Dim mode As Int
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
mode = r.RunMethod("getMode")
Log("Audio mode = " & mode)
Return mode
End Sub
[/code]
I don't think that there is any other API to get the audio mode.