This topic addresses considerations when developing for an Android device:
The OpenTok Android SDK uses following permissions:
android.permission.CAMERA
— If your app does not use
the default video capturer and does not access the camera, you can
remove this permission.
android.permission.INTERNET
— Required.
android.permission.RECORD_AUDIO
— If your app does not use
the default audio device and does not access the microphone, you can remove
this permission.
android.permission.MODIFY_AUDIO_SETTINGS
— If your app
does not use the default audio device and does not access the microphone,
you can remove this permission.
android.permission.BLUETOOTH
— The default audio device supports
Bluetooth audio. If your app does not use the default audio device and does not
use Bluetooth, you can remove this permission.
android.permission.BROADCAST_STICKY
— We have determined that this is
unused by the OpenTok Android SDK, and we will remove this permission from an upcoming release.
android.permission.READ_PHONE_STATE
— We have determined that this is
unused by the OpenTok Android SDK, and we will remove this permission from an upcoming release.
You do not need to add these to your app manifest. The OpenTok Android SDK adds them automatically. However, if you use Android 21+, certain permissions require you to prompt the user.
Your app can remove any permissions requested by the OpenTok Android SDK that it
does not use. See this post
and this
Android documentation. For example, this removes the
android.permission.CAMERA
permission:
<uses-permission android:name="android.permission.CAMERA" tools:node="remove"/>
Use the Android ConnectionService class to create a VoIP app that uses the audio-video capabilities of the OpenTok Android SDK.
At a minimum, follow these guidelines to create a basic VoIP app:
Register the android.telecom.ConnectionService
in the AndroidManifest.xml file.
android.telecom.ConnectionService
class.
Implement methods of the ConnectionService
class, including
onCreateIncomingConnection()
, onCreateOutgoingConnection
,
onCreateIncomingConnectionFailed()
, and onCreateOutgoingConnectionFailed()
.
android.telecom.Connection
class.
Implement methods of the Connection
class, including
onAnswer()
and onDisconnect
. In the implementation of the
onAnswer()
method, you can connect to an OpenTok session, publish a stream to
the session, and enable code to subscribe to streams created in the session. In the implementation
of the onDisconnect()
method, you can disconnect from the OpenTok sesssion
(and stop publishing and subscribing to streams).
See the sample VOIP app in the opentok-android-sdk-samples repo. It shows how to implement the ConnectionService class to create a VoIP app that uses the OpenTok Android SDK.
For more information, see: