Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This tutorial will show you how to integrate Restcomm Client Android SDK into your Apps to tap into the Restcomm telecom capabilities.
This tutorial will show you how to integrate Restcomm WebRTC Android SDK into your Apps to tap into the Restcomm telecom capabilities.

[[prerequisites]]
Prerequisites
Expand All @@ -17,17 +17,17 @@ Here you have three alternativess:
* Install the latest link:https://hub.docker.com/r/restcomm/restcomm/[Restcomm Docker image] locally (i.e. $ docker pull restcomm/restcomm to get it from docker hub). For more information please check link:http://www.telestax.com/rapid-webrtc-application-development-with-restcomm-and-docker/ and link:https://github.com/RestComm/Restcomm-Docker#restcomm-docker-image. If you aren't familiar with docker you can have a quick intro here https://www.docker.com/

[[restcomm-client-androidsdk]]
2. Restcomm Client Android SDK
2. Restcomm WebRTC Android SDK
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once you have installed the  Restcomm platform (or you are using RaaS) you are ready to start taking advantage of Restcomm's features from your Android Applications. Here's what you need to do:

* Grab the latest Restcomm Client Android SDK release from GitHub: https://github.com/RestComm/restcomm-android-sdk/releases/tag/v1.0.0-BETA4. At the time of this writing it is v1.0.0-beta5 and the bundle you need to download is restcomm-android-sdk-1.0.0-beta5.tar.bz2
* Grab the latest Restcomm WebRTC Android SDK release from GitHub: https://github.com/RestComm/restcomm-android-sdk/releases/tag/v1.0.0-BETA6. At the time of this writing it is v1.0.0-beta6 and the bundle you need to download is restcomm-android-sdk-1.0.0-beta6.tar.bz2
* Extract it:
+
[source,theme:github,toolbar:2,lang:default,decode:true]
----
$ tar -jxvf restcomm-android-sdk-1.0.0-beta5.tar.bz2
$ tar -jxvf restcomm-android-sdk-1.0.0-beta6.tar.bz2
----

[[use-the-existing-sample-androidapp-helloworld]]
Expand Down Expand Up @@ -133,7 +133,7 @@ project(':restcomm.android.sdk').projectDir=new File('../../restcomm.android.sdk
[Update 'app' module settings]
image:./images/updated-module-settings.png[Update 'app' module settings,width=821,height=683]
+
* Ok, now that we have all the settings ready the App should be able to build and run but with no actual functionality yet. For that we need to take advantage of the SDK facilities. So first you need to import required Android Client packages and make your Activity the listener of Android Client events (such as incoming calls and messages) as well as OnClick events for the buttons:
* Ok, now that we have all the settings ready the App should be able to build and run but with no actual functionality yet. For that we need to take advantage of the SDK facilities. So first you need to import required Android SDK packages and make your Activity the listener of Android SDK events (such as incoming calls and messages) as well as OnClick events for the buttons:
+
[source,java,theme:github,toolbar:1,lang:default,decode:true]
----
Expand All @@ -147,7 +147,7 @@ import org.restcomm.android.sdk.RCPresenceEvent;
public class MainActivity extends Activity implements RCDeviceListener, RCConnectionListener, OnClickListener, ServiceConnection {
...
----
* Once you do that you 'll have to implement the Android Client listener interface methods with empty stubs so that Java doesn't complain. Notice that for this example we are keeping things simple and not handling incoming events, but you could add that later. An exception are the webrtc video events (i.e. onReceiveLocal/RemoteVideo), which need to be there so that the video tracks can be added to our video view.
* Once you do that you 'll have to implement the Android SDK listener interface methods with empty stubs so that Java doesn't complain. Notice that for this example we are keeping things simple and not handling incoming events, but you could add that later. An exception are the webrtc video events (i.e. onReceiveLocal/RemoteVideo), which need to be there so that the video tracks can be added to our video view.
+
[source,java,theme:github,toolbar:1,lang:default,decode:true]
----
Expand All @@ -157,34 +157,11 @@ public void onStartListening(RCDevice device, RCDeviceListener.RCConnectivitySta

}

public void onStopListening(RCDevice device)
{

}

public void onStopListening(RCDevice device, int errorCode, String errorText)
{
Log.i(TAG, errorText);
}

public boolean receivePresenceEvents(RCDevice device)
{
return false;
}

public void onPresenceChanged(RCDevice device, RCPresenceEvent presenceEvent)
{

}

public void onIncomingConnection(RCDevice device, RCConnection connection)
{
}

public void onIncomingMessage(RCDevice device, String message, HashMap<String, String> parameters)
{
}

public void onConnectivityUpdate(RCDevice device, RCConnectivityStatus connectivityStatus)
{

Expand Down Expand Up @@ -259,7 +236,7 @@ public void onInitializationError(int errorCode, String errorText)
{
}
----
* Add the needed Android Client objects (i.e. RCDevice and RCConnection) in the Activity class as well as some convenience variables:
* Add the needed Android SDK objects (i.e. RCDevice and RCConnection) in the Activity class as well as some convenience variables:
+
[source,java,theme:github,toolbar:1,lang:default,decode:true]
----
Expand All @@ -271,7 +248,7 @@ public class MainActivity extends Activity implements RCDeviceListener, RCConnec
boolean serviceBound = false;
....
----
* In order to make the buttons we created available to the App and also initialise the Android Client you need to update the onCreate() method of your activity as follows:
* In order to make the buttons we created available to the App and also initialise the Android SDK you need to update the onCreate() method of your activity as follows:
+
[source,java,theme:github,toolbar:1,lang:java,decode:true,linenums]
----
Expand Down Expand Up @@ -300,7 +277,7 @@ protected void onCreate(Bundle savedInstanceState) {

}
----
* Handle Android Service callbacks to initialized the SDK facilities. Remember that the SDK is wrapped inside and Android Service to be able to linger on even after Activities have been sent in the background or have been destroyed.
* Handle Android Service callbacks to initialized the SDK facilities. Remember that the SDK is wrapped inside an Android Service to be able to linger on even after Activities have been sent in the background or have been destroyed.
+
[source,java,theme:github,toolbar:1,lang:java,decode:true]
----
Expand Down Expand Up @@ -460,7 +437,7 @@ private void resumeCall()
[Restcomm Android Demo]
image:./images/android-device.png[Restcomm Android Demo,width=402,height=746]
+
* Now press dial and your Appliation will instruct the Android Client Library to call the configured Restcomm instance and voila, you will hear the announcement!
* Now press dial and your Appliation will instruct the Android SDK to call the configured Restcomm instance and voila, you will hear the announcement!
* Finally, you can press Hang up to terminate the call whenever you like.

That's it! Give it a try it and share your experience with the rest of the Restcomm community, or even better, jump in and get your hands dirty with the code! Here are some additional resources:
Expand Down