This page explains how you can get up and running quickly with the Gruveo SDK for Android.
At least Android 4.2.x (API 17) is required.
The SDK manifest file contains the features and permissions below. You do not have to add them in your project.
The Manifest.permission.RECORD_AUDIO
permission is mandatory for making calls, Manifest.permission.CAMERA
is needed only for video calls. However, it is all handled by the SDK, so you do not have to worry about these details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <uses-feature android:name="android.hardware.camera" android:required="false"/> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.BLUETOOTH"/> |
The SDK is minified with self-contained ProGuard rules, so you do not have to add any either.
Include JitPack by adding the following in your project's build.gradle
:
1 2 3 4 5 6 | allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } |
Add Gruveo SDK in your module's build.gradle
dependencies:
1 | compile 'org.bitbucket.gruveo:gruveo-sdk-android:{latest version}' |
Add the following activity in your manifest file:
1 2 3 | <activity android:name="com.gruveo.sdk.ui.CallActivity" android:configChanges="orientation|screenSize"/> |
The Kotlin snippet below launches a Gruveo screen to connect to the gruveorocks
call room.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | private val SIGNER_URL = "https://api-demo.gruveo.com/signer" override fun onCreate(savedInstanceState: Bundle?) { ... Gruveo.Builder(this) .callCode("gruveorocks") .clientId("demo") .eventsListener(eventsListener) .build() } private val eventsListener = object : Gruveo.EventsListener { override fun requestToSignApiAuthToken(token: String) { Gruveo.authorize(signToken(token)) } ... } private fun signToken(token: String): String { val body = RequestBody.create(MediaType.parse("text/plain"), token) val request = Request.Builder() .url(SIGNER_URL) .post(body) .build() val response = OkHttpClient().newCall(request).execute() return response.body()?.string() ?: "" } |
Let's break down this example.
gruveorocks
call room. We also pass the demo
client ID to the SDK to identify the SDK user, as well as bind an event listener object. Check out SDK Reference for more details on the initialization.requestToSignApiAuthToken
event used for SDK authentication.signToken()
method on lines 19-28 uses a server endpoint provided by Gruveo to sign tokens for the demo
client ID as part of the SDK authentication scheme. Note that when using a production client ID, you will need your own endpoint as well as a way to authenticate your app with it.