Skip to main content

Basic

Installation

To install this SDK in your Android project, you need to do the following steps,

  1. Add jitpack to your project-level gradle file:

    allprojects {
    repositories {
    ...
    maven { url "https://jitpack.io" }
    }
    }
  2. Add the module on your module-level gradle file:

    dependencies {
    implementation 'com.github.SmartWalkieOrg:VoicePing-Walkie-Talkie-AndroidSDK:1.0'
    }
  3. Sync gradle and use it

How to use VoicePing Android SDK

Initialize

Initialize VoicePing in your Application code, inside onCreate method

class VoicePingClientApp : Application() {
override fun onCreate() {
super.onCreate()
VoicePing.init(this, "voiceping_sdk_server_url")
}
}

Connect

Before you can start talking, you need connect to server. You can do that by call connect method from VoicePing instance.

VoicePing.connect("your_user_id", "your_company", object : ConnectCallback {
override fun onConnected() {
// Do something
}

override fun onFailed(exception: VoicePingException) {
// Do something
}
})

Start Talking

After successfully connected, you can now start talking. You can start talking to individual receiver using:

VoicePing.startTalking("receiver_id", ChannelType.PRIVATE, this)

or in a group using:

VoicePing.startTalking("group_id", ChannelType.GROUP, this)

Before you can talk in a group, you need to join a group first, please look at item 6 below.

Stop Talking

To stop talking, for both Private and Group PTT:

VoicePing.stopTalking()

Disconnect

You can disconnect to stop receiving PTT:

VoicePing.disconnect(object : DisconnectCallback {
override fun onDisconnected() {
// Do something
}
})

Join a group

You cannot listen to a group channel before joining it. To join a group channel:

VoicePing.joinGroup("group_id")

Leave a group

To leave a group channel:

VoicePing.leaveGroup("group_id")

Mute specific channel

To mute specific channel:

VoicePing.mute("target_id", ChannelType.PRIVATE)
// or ChannelType.GROUP if you want to target group

Unmute specific channel

To unmute specific channel:

VoicePing.unmute("target_id", ChannelType.PRIVATE)
// or ChannelType.GROUP if you want to target group

Customization

You can customize the size, color, of the mic button. You can also customize the shape of the mic button. Or you can have your own PTT button.

<com.smartwalkie.voicepingsdk.VoicePingButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:shape="..." (oval / rectangle)
app:radius="..."
app:backgroundColor="..."
app:micColor="..."
/>

VoicePing server URL

VoicePing Android SDK needs a VoicePing server to work. You can test with our hosted server or you can have your own self hosted server later. You can look at this section to know how to self-host the server.

The public server URL: wss://router-lite.voiceping.info