<main>
<article class="userContent">
<p><br></p><h2 data-id="general">General</h2><div class="blockquote"><div class="blockquote-content"><p class="blockquote-line">This article applies to all TeamViewer Assist AR users.</p></div></div><p>With TeamViewer Software Development Kit (SDK) you can utilize full Assist AR functionality and provide the best AR remote support experience to your customers by embedding AR remote assistance capabilities within your own mobile apps. </p><p>The SDK enables you to have secure and GDPR compliant connections to your customer's devices. </p><p><br></p><h3></h3><h2 data-id="prerequisites"><strong>Prerequisites</strong> </h2><ul><li>Android 5.0 and higher </li><li>An existing TeamViewer account </li></ul><p>If you don't have a TeamViewer account, follow the steps below to create one: </p><ol><li>Go to <a href="https://login.teamviewer.com/" rel="nofollow noreferrer ugc">https://login.teamviewer.com/</a> and click <strong>Sign Up</strong>. </li><li>Complete the steps to create an account and validate your email address. </li></ol><p><br></p><h3 data-id="-1"></h3><h2 data-id="generate-an-api-key"><strong>Generate an API key</strong> </h2><p>1) Go to <a href="https://login.teamviewer.com/" rel="nofollow noreferrer ugc">https://login.teamviewer.com/</a> and sign in using your TeamViewer account.</p><p>2) On the bottom of the page, click <strong>Apps</strong>.</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/DMZ7UJAZOLZW/image001.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/DMZ7UJAZOLZW/image001.png" alt="image001.png" height="88" width="562" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p><br></p><p>3) Click the <strong>Create App</strong> button.</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/R80FX60O1N7J/image002.jpg" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/R80FX60O1N7J/image002.jpg" alt="image002.jpg" height="600" width="937" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p><br></p><p>4) Activate <strong>Mobile SDK Token</strong>, enter a name, and (optional) add a short description.</p><p>5) Activate <strong>Android</strong>.</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/NSULTACREXZ0/image003.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/NSULTACREXZ0/image003.png" alt="image003.png" height="264" width="557" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p><br></p><p>6) Click <strong>Create</strong>.</p><p>Your token is displayed when opening the created app:</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/6T9N6BVERFQQ/image004.jpg" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/6T9N6BVERFQQ/image004.jpg" alt="image004.jpg" height="258" width="720" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p><br></p><p>Copy this token into your clipboard and paste it to a secure place.</p><p>⚠ <strong>IMPORTANT</strong>: <strong>Do not share</strong> this token with anyone!</p><p><br></p><h3 data-id="-2"></h3><h2 data-id="get-the-teamviewer-mobile-sdk"><strong>Get the TeamViewer Mobile SDK</strong> </h2><p>SDK is available for customers with an Assist AR Professional license and is distributed by the TeamViewer Support team. </p><p> </p><p>Integrate Your TeamViewer Mobile SDK </p><p>1) TeamViewer Mobile SDK for Android contains below files: </p><ol><li>TeamViewerSdk.aar (TeamViewer Mobile SDK) </li><li>AssistARSessionUI.aar (only needed if you want to establish AssistAR Session using SDK) </li><li>ScreenSharingSdk-docs (TeamViewerSdk documentation) </li><li>AssistARSessionUI-docs (AssistARSessionUI documentation) </li><li>The demo app is available under <a href="https://github.com/teamviewer/TravelApp/" rel="nofollow noreferrer ugc">https://github.com/teamviewer/TravelApp/</a> </li></ol><p><br></p><p>2) Create a libs folder under your app directory and copy the *.aar files there. </p><p>📌<strong>Note:</strong> The SDK supports the following architectures: armeabi-v7a, arm64-v8a, x86, x86_64. </p><p><br></p><p>3) Enable <strong>ViewBinding</strong> and add following dependencies to your app’s build.gradle:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">android {
buildFeatures {
viewBinding true
}
}
dependencies {
implementation files('libs/TeamViewerSdk.aar')
implementation files('libs/AssistARSessionUI.aar') //(Add only if you plan to use AssistAR(AssistAR) Session
// Add dependencies of AssistARSessionUI.aar(Add only if you plan to use AssistAR Session):
runtimeOnly "androidx.camera:camera-camera2:1.0.2"
runtimeOnly "androidx.camera:camera-lifecycle:1.0.2"
runtimeOnly "androidx.constraintlayout:constraintlayout:2.0.4"
runtimeOnly "androidx.fragment:fragment-ktx:1.3.6"
runtimeOnly "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
runtimeOnly "androidx.work:work-runtime-ktx:2.5.0"
runtimeOnly "com.google.android.material:material:1.4.0"
runtimeOnly "de.javagl:obj:0.3.0"
runtimeOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31"
runtimeOnly "com.google.android.gms:play-services-mlkit-text-recognition:17.0.0"
runtimeOnly "com.squareup.picasso:picasso:2.8"
}
</pre><p><br></p><p>To get an updated list of dependencies please check AssistARSessionUI-docs/index.html which will be part of the SDK package you receive from TeamViewer. </p><p><br></p><p>4) Build the <strong>TeamViewerSdk</strong> object: </p><pre class="code codeBlock" spellcheck="false" tabindex="0"> teamViewerSdk = TeamViewerSdk.Builder(context)
.withToken(SDK_TOKEN)
.withAuthenticationCallback(sdkAuthenticationCallback)
.withSessionCallback(sdkSessionCallback)
.withErrorCallback(sdkErrorCallback)
.withOnlineStateCallback(onlineStateCallback)
.withMicInitiallyMuted(true)
.build()
}
</pre><p><br></p><p>The above example shows the creation teamViewerSdk object using <strong>SDK_TOKEN (</strong>use<strong> SDK_TOKEN </strong>created above in step 7 of “Generate API Key Section”) </p><p>Please visit ScreenSharingSdk-docs/com/teamviewer/sdk/screensharing/TeamViewerSdk.Builder.html to learn more details about these builder methods. The documentation will be part of SDK package you receive from TeamViewer. </p><p><br></p><p>5) Connect to a session code </p><p>The shared SDK provides a method for establishing a connection to a session code. This session code can be of two types: </p><ul><li>Remote Support or </li><li>Assist AR </li></ul><p><br></p><p>6) Create session codes in your TeamViewer Client (select the type <strong>Remote Support</strong> or <strong>AssistAR</strong> based on the session you want) or via the TeamViewer REST API.</p><pre class="code codeBlock" spellcheck="false" tabindex="0">teamViewerSdk.connectToSessionCode(sessionCode)
</pre><p><br></p><p>Once <strong>sessionCode</strong> is online, a connection can be initiated from TeamViewer Client side. </p><p>The session code state can be checked using OnlineStateCallback (ScreenSharingSdk-docs/com/teamviewer/sdk/screensharing/TeamViewerSdk.Builder.html#withOnlineStateCallback(com.teamviewer.sdk.screensharing.OnlineStateCallback). </p><p><strong>OnlineStateCallback</strong> is useful to get notified of the SDK online/offline/connected state:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">private val onlineStateCallback = OnlineStateCallback { onlineState ->
val isSdkOnline = OnlineStateCallback.OnlineState.OFFLINE
val isSdkOffline = OnlineStateCallback.OnlineState.ONLINE
val isSessionCodeConnected = OnlineStateCallback.OnlineState.CONNECTED
}
</pre><p><br></p><p><strong>ErrorCallback</strong> is useful to handle error codes sent by the SDK in case the session code is invalid, expired, or closed. ( ScreenSharingSdk-docs/com/teamviewer/sdk/screensharing/TeamViewerSdk.Builder.html#withErrorCallback(com.teamviewer.sdk.screensharing.ErrorCallback))</p><pre class="code codeBlock" spellcheck="false" tabindex="0">private val sdkErrorCallback = ErrorCallback { errorCode ->
val invalid = errorCode == ErrorCallback.ErrorCode.SESSION_CODE_INVALID
val expired = errorCode == ErrorCallback.ErrorCode.SESSION_CODE_EXPIRED
val closed = errorCode == ErrorCallback.ErrorCode.SESSION_CODE_CLOSED
}
</pre><p><br></p><h3 data-id="-3"></h3><h2 data-id="reacting-to-incoming-connections"><strong>Reacting to incoming connections</strong> </h2><p>The SDK provides callback methods for reacting to incoming connection events. </p><h3 data-id="1)-authenticationcallback">1) AuthenticationCallback </h3><p><strong>AuthenticationCallback</strong> is useful to handle incoming connections. </p><p><strong>AuthenticationData</strong> parameter contains the name of the supporter and a callback function to allow or reject the incoming connection.</p><p><br></p><pre class="code codeBlock" spellcheck="false" tabindex="0">private val sdkAuthenticationCallback = object : AuthenticationCallback {
override fun onAuthentication(data: AuthenticationData?) {
//set true to accept call, set false to reject call
data?.callback?.onAuthenticationResult(true)
Logging.info(TAG, "TeamViewer connected to ${data?.partnerName}")
}
override fun onAuthenticationCanceled() {
// Is called when TeamViewer Authentication was cancelled from TeamViewer client/expert side
}
}
</pre><p><br></p><p>If the incoming connection is accepted, the corresponding TeamViewer connection is established. </p><ul><li>For the ScreenShare connection, a prompt for microphone permission is shown to the user. (Asking for microphone permission for ScreenShare Session should be implemented by App Developer in SessionCallback.) </li><li>For the Assist AR connection, the system permissions for camera and microphone access are shown. If the user allows this, the AR session is started. </li><li>If the client/expert sends file to the server, storage permission is asked to move files to Downloads directory after the end of the session . </li><li>There is bi-directional VoIP communication between the user and the supporter. The initial mic state is unmuted, but this can be changed using the sdk Builder method <a href="unsafe:about:blank" rel="nofollow noreferrer ugc">withMicInitiallyMuted</a>(boolean muted). </li></ul><p> </p><h3 data-id="2)-sessioncallback">2) SessionCallback </h3><p>Once the connection is initiated on the TeamViewer side, the SDK gets notified about this connection attempt via SessionCallback. </p><p>I) AssistARSession(AssistARSession): </p><p>For AssistAR sessions make sure to -></p><ul><li>Set AssistARSessionUI.currentSession = session in onSessionStarted() </li><li>launch AssistARSessionActivity as mentioned in below code. </li><li>Set AssistARSessionUI.currentSession = null in onSessionEnded()</li></ul><p><br></p><pre class="code codeBlock" spellcheck="false" tabindex="0">private val sdkSessionCallback = object : SessionCallback {
override fun onSessionStarted(session: TeamViewerSession?) {
if (session is AssistARSession) {
AssistARSessionUI.currentSession = session
val intent = AssistARSessionUI.createIntentForAssistARSessionActivity(context, "StorageFolderName")
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
context.startActivity(intent)
}
if (session is ScreenSharingSession) {
//Request microphone permission if you intend to use VOIP with ScreenShare Session
}
}
override fun onSessionEnded() {
Logging.info(TAG, "TeamViewer Session ended")
AssistARSessionUI.currentSession = null
}
}
</pre><p><br></p><p>Passing storageFolderName to the createIntentForAssistARSessionActivity method here is mandatory as this is the name of the folder where shared documents will be stored under the Downloads folder. For details check out AssistARSessionUI-docs/-pilot-session-u-i/com.teamviewer.sdk.assistarsessionui/-assist-a-r-session-u-i/create-intent-for-assist-a-r-session-activity.html </p><p> </p><p>II) ScreenSharingSession: </p><p>ScreenSharingSession requires to request the microphone permission in OnSessionStarted() if you intend to use VOIP. </p><p> </p><p><strong>Logging: </strong> </p><p>Builder method <code class="code codeInline" spellcheck="false" tabindex="0">withLogger(Logger callback)</code> sets a Logger callback to which all log output from the TeamViewer Sdk is delegated to. </p><p>To check out details for this callback and other additional callbacks available with Sdk builder please visit ScreenSharingSdk-docs/com/teamviewer/sdk/screensharing/TeamViewerSdk.Builder.html.</p>
</article>
</main>