Signaling Quickstart - Android Beta

Step 1: Obtain the Sample Code

Download Agora Signaling SDK from downloads, or contact sales-us@agora.io.

Agora Signaling SDK for Android package structure is listed as follows:

  • ./libs: including the required libraries
  • ./samples: including the sample code called myapp1

Note

The sample code currently only supports audio function. Video function will be provided later.

Step 2: Prepare the Environments

Be sure that the following development environment requirements are satisfied:

Platform System Requirement Network Requirement
Android Android API 15 or later Port: HTTP 80 ,TCP 8181

Note

Both real device and emulator are acceptable.

If you want to use the Agora Signaling SDK together with Agora Native SDK, be sure that the requirements of Agora Native SDK are also satisfied.

Step 3: Compile the Sample Code

  1. Select Import project (Eclipse ADT, Gradle, etc.) in the Android Studio.

    ../../_images/android-demo-video-11.png
  2. Import myapp1 using the import function of Android Studio.

    ../../_images/signal_demo_android_0.1.png
  3. Fill the App ID, App Certificate as highlighted below in the ActivityLogin.java file.

You can follow Obtaining an App ID and an App Certificate to get your App ID and APP Certificate.

For example,

../../_images/signal_demo_android_0.2.png

Warning

In this demo, you can put the App Certificate directly here on the client side, but in product environment, keep your App Certificate on the server and never on any client machine.

  1. Click the Run button to compile the sample code.
../../_images/signal_demo_android_0.3.png

Step 4: Execute the Sample Code

It requires two devices to demonstrate the functions included in the sample code.

Open the myapp1 application on the Android device after the compilation, and it displays the following screen:

../../_images/signal_demo_android_0.png

The following table shows the function of the main buttons/menus:

Button Function
LOGIN Log onto the signaling system.
SWITCH Switch the calling party and the called party.
CALL Make a call.
INSTMSG Send the instant messages.
JOIN Join the channel.
MSG Send the channel messages.
xxx The user name of the calling party
yyy The user name of the called party
demoroom1 the pre-fined channel name
SPEAKER Enable the speaker.
MUTE Mute oneself.
ENV

Switch between test and product environment.

  • DEG: for test environment
  • PROD: for production environment

Executing the sample code according to the following scenarios:

  • Login
  • Join Channel
  • Make a Call

Scenario 1: Login

  1. Click LOGIN on both screens to login onto the signaling system. It returns Login successfully upon a successful login.

    ../../_images/signal_demo_android_1.png
  2. Send an instant message.

    • On the left, click INSMSG: the user xxx sends an instant message to the user yyy.
    • On the right, the user yyy receives the message as highlighted below, and vice versa.
    ../../_images/signal_demo_android_2.png
  3. Click LOGOUT on both screens to log out of the signaling system if necessary. It returns Logout successfully.

    ../../_images/signal_demo_android_3.png

Scenario 2: Join Channel

  1. Be sure that both users are logged in.

  2. Click JOIN on both screens to join the channel demoroom1.

    It returns Join channel demoroom1 successfully, the user names and their corresponding UID who joined the channel.

    ../../_images/signal_demo_android_4.png
  3. Send a channel message.

    • On the left, click MSG: the user xxx sends a channel message.
    • Both user xxx and user yyy receive the channel message.
    ../../_images/signal_demo_android_5.png
  4. Click LEAVE on both screens to leave the demoroom1 channel if necessary.

    ../../_images/signal_demo_android_6.png

Scenario 3: Make a Call

  1. Ensure that both users are logged in.

  2. On the left, click CALL: the user xxx make a call request.

    1. The user xxx automatically joins the channel demoroom1 and gets the current user list in the channel.
    2. The user yyy receives the call invitation.
    3. The user xxx receives the callback that the user yyy has received the invitation.
    4. The user yyy automatically joins the channel demoroom1 and gets the user list in the channel.
    5. The user xxx receives the callback that user yyy has accepted the invitation and has joined the channel demoroom1.
    ../../_images/signal_demo_android_0.7.png

    Both users can now start to talk with each other.

  3. On the left, click END to end the call. Both users will leave the channel automatically.

    ../../_images/signal_demo_android_0.8.png
  4. Click LOGOUT on both screens to log out of the system if necessary.