Initial Setting
Important
You should complete the initial setting before enabling the SDK, otherwise, none of the functionalities provided by this SDK will be available.
Assuming you need to configure and start the ArctosLinks SDK when the application starts, here is an example of how to use this method correctly:
Swift
import ArctosLinks
func initializeArctosLinks() {
let accessToken = "your_access_token_here"
ArctosLinks.configure(with: accessToken) { result in
switch result {
case .success:
print("ArctosLinks SDK successfully configured!")
// you can proceed to the next step, such as notifying the user or loading initial data.
case .failure(let error):
print("Failed to configure ArctosLinks SDK: \(error.localizedDescription)")
// handle errors, such as displaying an error message or retrying configuration.
}
}
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks
private fun initializeArctosLinks() {
ArctosLinks.getInstance(Context).initialize(accessToken = accessToken)
.onSuccess {
Log.d(TAG, "initialize onSuccess")
}.onFailure { initailzeFailure ->
Log.d(TAG, "initialize onFailure ${initailzeFailure.message}")
}
}
private suspend fun initializeArctosLinksMedia() {
runCatching {
ArctosLinks.getInstance(Context).mediaManager.initMedia(
context = Context,
lifecycleOwner = viewLifecycleOwner
).getOrThrow()
}.onSuccess {
Log.d(TAG, "initialize Media success")
}.onFailure {
Log.d(TAG, "initialize Media failed ${it.message}")
}
}
c++
#include "arctos_qt.h"
void initializeArctosLinks(bool is_host, const std::string& name, const std::string& license) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.start();
if (is_host) {
// this method will emit loginFailed signal when failed
arctos_app.loginAsHost(name, license);
} else {
// this method will emit loginFailed signal when failed
arctos_app.loginAsParticipant(name, license);
}
}
Parameter Description
- accessToken: This is an access token used to start ArctosLinks, obtained after applying for a License.
- Use accessToken to initialize the SDK. If successful, it will return success; if failed, it will return failed and provide an error message.
- Android needs to initialize the SDK media manager before using the media function.