Android Question Setting the Call Mode to MODE_NORMAL, and Volume Control Buttons, how they react.

Jmu5667

Well-Known Member
Licensed User
Hello All

This is an odd one to explain so here goes.

We have developed a PTT app that uses the ABTO SIP SDK for B4A, we paid them to wrap their existing andoid sdk for B4A, some of you may have seen it on the forum.

When the PTT app connect to PTT server (we developed it) a SIP call is obviously active on the phone. This can be problem when a normal GSM call occurs, as the phone says 'Oh I'm already in a call and handles the call with a beep to the user or what ever that particular device does."

So, to overcome this problem with set the call mode to MODE_NORMAL, if the is no talking on the PTT, i.e users are not speaking to each other.

Now the issue. Since we are in MODE_NORMAL, when you press the vol up/down, on most phone the ringer vol notification is displayed, great, that is what we want. However on most/all samsung devices the call vol notification is displayed, telling us that the samsung device is ignoring the MODE_NORMAL and knows the SIP call is active.

Does anyone have any insights to this or experienced this and have a work around.

I hope I have explained this well enough, and as usual all suggestions appreciated.

Regards
John.
 

Jmu5667

Well-Known Member
Licensed User
How are you setting it?

I have a class and this is the function:

B4X:
Sub SetMode(value As Int)
   
   Try
       Dim ctxt As JavaObject
       ctxt.InitializeContext
       Dim audioManager As JavaObject = ctxt.RunMethodJO("getSystemService", Array(ctxt.GetField("AUDIO_SERVICE")))
       Dim audioManagerStatic As JavaObject
       audioManagerStatic.InitializeStatic("android.media.AudioManager")
     
       Dim p As Phone, iMode As Int = value
       mod_functions.writeLog("cls_audio() SetMode " & value)
       If p.SdkVersion > 20 Then
           If iMode = MODE_IN_CALL Then
               iMode = MODE_IN_COMMUNICATION
               mod_functions.writeLog("cls_audio() SetMode, Switiching to MODE_IN_COMMUNICATION instead of MODE_IN_CALL")
           End If
       Else

       End If
       ' // SET THE MODE
       audioManager.RunMethod("setMode", Array(iMode))
   Catch
       mod_functions.writeLog("cls_audio() SetMode, error " & LastException.Message)
   End Try
   
End Sub
 
Upvote 0
Top