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";
}
})