Android Question For Studying AudioManager States/modes

persianpowerman1

Active Member
Licensed User
Longtime User
hey guys...
i wanted to make some sort of a demo which i could run from a service to study the AudioManager states/modes

since im not too good with reflection.. and dont know how to incorporate this stuff from SDK... needed your help...
thanx in advance...

this is what i got from the Android SDK link


---------1---------
public int getMode ()
Added in API level 1
Returns the current audio mode.

Returns
the current audio mode (MODE_NORMAL, MODE_RINGTONE, MODE_IN_CALL or MODE_IN_COMMUNICATION). Returns the current current audio state from the HAL.

----------2-------------
public static final int MODE_IN_CALL
Added in API level 1
In call audio mode. A telephony call is established.

Constant Value: 2 (0x00000002)

---------3----------
public boolean isMicrophoneMute ()
Added in API level 1
Checks whether the microphone mute is on or off.

Returns
true if microphone is muted, false if it's not

-----------------x--x-x-------------------------

can anyone show me how to incorporate this in coding.. will realy be helpful
 

persianpowerman1

Active Member
Licensed User
Longtime User
hi erel.. thanx for showing me how to use that...
i put this in PhoneStateReceiver demo i found... and added your code to this proj.
from your lead i also made...


B4X:
Sub GetMikeVal As Boolean
  Dim r As Reflector
  r.Target = r.GetContext
  r.Target = r.RunMethod2("getSystemService", "audio", "java.lang.String")
  Return r.RunMethod("isMicrophoneMute")
End Sub


im kinda understanding how to use RunMethod... though need more learining...
similarly could you teach me how to put this in our B4a code...
------------------------------------
intSTREAM_ALARMThe audio stream for alarms
intSTREAM_DTMFThe audio stream for DTMF Tones
intSTREAM_MUSICThe audio stream for music playback
intSTREAM_NOTIFICATIONThe audio stream for notifications
intSTREAM_RINGThe audio stream for the phone ring
intSTREAM_SYSTEMThe audio stream for system sounds
intSTREAM_VOICE_CALLThe audio stream for phone calls
---------------------------------------

Are these constants... ? to make me under stand ... show me a small piece of code to kinda know when the phone is eg. STREAM_ALARM?

please see my Project too...

YO!han
 

Attachments

  • FromPhoneStateListner.zip
    8.2 KB · Views: 194
Upvote 0
Top