Whereby is the easiest way to embed video calls into your web page or mobile app.
This repository contains the Whereby framework for Android platform. You will find complete running examples using the SDK, in both Java and Kotlin languages, in our demo apps.
Other platforms:
Be informed that this is a beta version of the framework. For any comments, suggestions or questions, please reach out to our customer support: embedded@whereby.com
- Signup for a Whereby Embedded account
- Create a room and get the roomURL
- Have Android Studio installed with a running Android app
The framework is distributed using Jitpack. If it is not already the case, add the Maven and Jitpack repositories to your Android project. This can be done either in the project build.gradle file (not to be confused with the module build.gradle file) or in the settings.gradle file:
repositories {
...
mavenCentral()
maven { url 'https://jitpack.io' }
}
Then, add the Whereby SDK dependency to your module build.gradle file. You can specify either a full name X.X.X
version (see the list of released versions) or simply use a range format X.+
:
dependencies {
...
def WHEREBY_SDK_VERSION = '0.+'
implementation("com.github.whereby:android-sdk:$WHEREBY_SDK_VERSION@aar") { transitive = true }
}
Remember to sync your project after updating the gradle files.
In the module build.gradle file, make sure the minimum API level is equal or greater than 23:
android {
...
defaultConfig {
...
minSdk 23
}
}
Remember to sync your project after updating the gradle files.
-
Import
WherebySDK
at the top of your file (typically this would be in yourActivity
orFragment
subclass):import com.whereby.sdk.*;
-
Provide the room URL. The room URL would usually be created by your own backend using Whereby API (for more details see Creating and deleting rooms):
URL roomURL = new URL("https://...");
-
Create a WherebyRoomConfig:
WherebyRoomConfig roomConfig = new WherebyRoomConfig(roomURL);
Optionally, you can customize the room:
roomConfig.setCameraEnabledAtStart(true); roomConfig.setMicrophoneEnabledAtStart(true); roomConfig.setDisplayName("Participant name"); // ...
-
Setup your
WherebyRoomFragment
with its arguments in your source file and layout:WherebyRoomFragment roomFragment = new WherebyRoomFragment(); Bundle bundle = new Bundle(); bundle.putSerializable(ROOM_CONFIG_KEY, roomconfig); roomFragment.setArguments(bundle);
<FrameLayout android:id="@+id/layout_whereby_fragment_container" .../>
Optionally, you can setup an asynchronous event listener. This allows to receive events during the meeting through a list of callbacks methods:
roomFragment.setEventListener(new WherebyEventListener() { @Override public void onMicrophoneToggled(boolean enabled) { // Update custom microphone button, for instance } @Override public void onCameraToggled(boolean enabled) { // Update custom camera button, for instance } // ... });
You can also create your own buttons to send commands once the meeting has started:
toggleCameraButton.setOnClickListener(view -> roomFragment.toggleCameraEnabled()); toggleMicrophoneButton.setOnClickListener(view -> roomFragment.toggleMicrophoneEnabled());
-
Load the fragment and join the meeting:
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.layout_fragment_container, roomFragment); fragmentTransaction.commit(); roomFragment.join();
Then, the fragment can be removed after the meeting has ended:
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.remove(mRoomFragment); fragmentTransaction.commit(); mRoomFragment = null;
-
We recommend to add the following
androidConfig
in theAndroidManifest
, to avoid the activity to be destroyed and re-created on screen rotation:<application ... <activity ... android:configChanges="orientation|screenSize"> </activity> </application>
Whereby publishes these packages to help the developer community understand how the Whereby Embedded product can be implemented.
Whereby does not recommend using such examples in a production environment without a prior assessment and appropriate testing relevant to the production setup targeted which can be of operational, technical, security or legal (e.g. library licenses assessment) nature. You expressly agree that the use of these packages is at your sole risk.
Whereby, its affiliates, suppliers, or licensors, whether express or implied, do not make any representation, warranties, contractual commitments, conditions, or assurances by the operation of these examples, or the information, content, materials, therein.