B9X Voice Client SDK For Android

The B9X Voice Client Library For Android works seamlessly with the B4A- Basic For Android development environment. Just save the two library files to your Additional Libraries folder, load the example project, compile, and install the example on your Android phone/Tablet/device. The B9X Voice Client SDK For Android includes a B4A library Module. This is free of charge and distributable, as an embedded library, in your .apk file or app bundle file. There are no royalties when used with any purchased version of B9X Voice Server(TM).

The download link below is to the B9X Voice Client SDK For Android. This file includes the required b4a library and a sample app. You can install it on the computer running Basic For Android(b4a) from Anywhere Software. With the sample app on your phone, you can connect to B9X Voice Server(TM) using the ip, of the machine that is running our server, and the default port of 18000. In the example project, be sure to first set the IP of the PC running the B9X Voice Server(TM).

With 2 smart phones connected to our server, the 2 smart phones can communicate with each other. If more smart phones are connected, they can also communicate with the group.

The description of the library’s methods and subs are described below:

Initialize(vCallback As Object, vEventName As String) – Initialize the library. This must be called before calling any other methods.

  • vCallback – set to Me.
  • vEventName – This is the name of the event that will receive status messages. If the eventName is set to “vx”, then a sub you create, “Sub vx_messageReceived(msg As String)” will be called when status messages are received.

vSetkey(sKey As String) – This sets the key for encryption of the connection to and from the server.

  • sKey – This key is required, must be exactly 32 bytes long, and must be identical to the key set at the server.

vClearKey – This clears the key. The library will not be able to connect to the server if the key is cleared.

vConnect(password As String)- This method connects to the B9X Voice Server(TM). Once connected to the server, real time audio chat with other clients can take place.

  • password – The password is required. The server has two passwords to set. The Admin Password, at the server, allows for both voice chat and broadcast messages. The Password, at the server, allows only voice chat.

Returns: The “[CONNECT_OK]” message will be returned in the vx_messageReceived event indicating that a successful connection was established with the server.

vClose(password As String) – This method closes the previous vConnect to the B9X Voice Server(TM). Once vClose is called, real time audio chat with other stops.

  • password -The password is required. You should use the same password that you used to vConnect.The server has two passwords to set. The Admin Password, at the server, allows for both voice chat and broadcast messages. The Password, at the server, allows only voice chat.

Returns: The “[CLOSE_OK]” message will be returned in the vx_messageReceived event indicating that the current connection was closed with the server.

vSetHost(sHost As String) – This method sets the host or ip used to connect to, along with other activities, B9X Voice Server(TM).

  • sHost – the ip address or hostname of the server.

vSetPort(sPort As Int) – This method sets the port used to connect to, along with other activities, B9X Voice Server(TM).

  • sPort – the port number of the server.

vSetListenPort(sPort As Int) – This method sets the port number that your app will listen on. This port will receive the audio and broadcast messages from the server.

  • sPort – The port number this client will listen on. This port number must be unique and cannot be a reserved or well established UDP ports. This port cannot be the same as the port set at the server.

vStartListening() – This method will start your app to listen for audio and status messages. Received audio will be heard by your phone’s speaker, etc.

Returns: “[VOICE_RECEIVE_ON][ip][port]” indicating voice audio was received from the server, at the ip and port of the server.
and “[VOICE_RECEIVE_OFF]” indicates that receiving voice audio stopped. These messages are received in the vx_messageReceived event.

vStopListening() – This method will stop your app from listening for audio and status messages

vStartSending() – This method will start sending audio, from your phone’s mic, to the server and any connected clients at the server.

Returns: “[START_SENDING]” – the vStartSending method was invoked. This message is received in the vx_messageReceived event.

vStopSending() – This method will stop sending audio to the server and any connected clients at the server.

Returns: “[STOP_SENDING]” – the vStopSending method was invoked. This message is received in the vx_messageReceived event.

vBroadcast(bMsg As String) – This method will send text to the server and any of its connected clients. You must have previously connected to the server with the Admin Password that was set at the server. You cannot use the characters: ‘[‘, ‘]’, ‘<‘ or ‘>’

Returns: “[BCAST_OK]” – the text you sent was sent successfuly to the server. This text, bMsg, is also sent to any server connected clients via UDP. This message is received in the vx_messageReceived event.

vSetVOXTrigger(voxValue As Int) – This method will enable or disable voice activated sending of audio.

  • voxValue – VOX sensitivity. To disable the VOX, set this value to zero. To enable the VOX set this value to a value greater than zero. A typical value is 3000 is a good VOX sensitivity.

Returns: “[VOX_TRIGGER_ON]” – the voice from the mic was triggered and “[VOX_TRIGGER_OFF]” – the voice from the mic stopped. These messages are received in the vx_messageReceived event.

vx_messageReceived(msg As String) – Define this sub so that your app will receive status messages. The prefix “vx” is set in the Initialize method as the string parameter vEventName.

Additional messages not defined below are:

“[VOX_TRIGGER_ON]” – the voice from the mic was triggered.
“[VOX_TRIGGER_OFF]” – the voice from the mic stopped.
“[PING]” – this string is sent periodically by the server to this client indicating an active connection to the server.

Sub vx_messageReceived(msg As String) 
   'to do
End Sub

References And Disclaimer

B9X Electronics

Website: https://b9xelectronics.com

B9X Voice Server™ and B9X Voice Client™ are trademarks of B9X Electronics.

Windows™ is a trademark of Microsoft Corporation.

Xojo™ is a trademark of Xojo.

B4A™ is a trademark of Anywhere Software.

Android™ and Google™ are trademarks of Google.

Yaesu™ and products mentioned are trademarks of Yaesu/Vertex Standard.

Icom™ and products mentioned are trademarks of Icom.

All other references are trademarks and copyrights of their respective holders.

The specifications in this document are only given to provide information, without any guarantee in regards to either mistakes or omissions. B9X Electronics reserves the right to make changes to the products contained in this publication for any reason.

IN NO EVENT WILL B9X ELECTRONICS BE LIABLE TO YOU OR ANYONE FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO INJURY TO PERSON OR PRODUCT, LOST PROFITS, LEGAL COSTS, LOST SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS AND ANY OF OUR PRODUCTS.