01-11-2023 08:21 PM - edited 01-11-2023 10:55 PM
Hello everyone,
I am new to app development, I am currently facing issue with the android SDK. I was following the instructions listed in the documentation page of the webex android SDK to set up a basic massaging system to test it, but somehow my app keep skipping in the webex initializing step and crash. I have no idea how to fix it. here is my code. I removed jwt token and room number in this post. my app also use flutter chennelmethod to communicate with kotlin to use the webex sdk massage function. IDK if this will affect it or not
import com.ciscowebex.androidsdk.Webex
import com.ciscowebex.androidsdk.message.LocalFile
import com.ciscowebex.androidsdk.message.Mention
import com.ciscowebex.androidsdk.message.Message
import com.ciscowebex.androidsdk.CompletionHandler
import android.webkit.WebView
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.ciscowebex.androidsdk.auth.JWTAuthenticator
import com.ciscowebex.androidsdk.auth.OAuthWebViewAuthenticator
import com.ciscowebex.androidsdk.auth.TokenAuthenticator
import android.util.Log
var token: String = "JWT token";
val authenticator: JWTAuthenticator = JWTAuthenticator()
val webex = Webex(application, authenticator)
webex.initialize(CompletionHandler { result ->
if (result.error != null) {
//already authorised
} else {
authenticator.authorize(token, CompletionHandler { result ->
if (result.error != null) {
//Handle the error
}else{
//Authorization successful
}
})
}
})
// testing posting massage in space
testing += "testing sending massage \n\n"
webex.messages.postToSpace("correct room number", Message.Text.plain("Hello from test app"), null, null, CompletionHandler<Message> { result ->
if(result != null && result.isSuccessful){
val message = result.data
testing += "send successful \n\n";
}
else
{
testing += "send failed \n\n";
}
})
01-12-2023 04:53 AM
@rust the best way to understand how to work with the Webex Android SDK is to test it out with our KitchenSink app here https://github.com/webex/webex-android-sdk-example . It has messaging implemented, so you can use it as a blueprint for your implementation.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide