I'm trying to get a route with Arcgis routeTask adding the token obtained from the service but it doesn't work correctly, sometimes it succeeds in authenticating and other times it doesn't, could you please help me?
I am using the java sdk..
var credential: UserCredential = UserCredential.createFromToken(arcgisToken,"www.arcgis.com")
fun solveRoute(){
val rouTask = RouteTask(appContext,"https://route-
api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")
rouTask.credential = credential
AuthenticationManager.setAuthenticationChallengeHandler(this)
rouTask.loadAsync()
rouTask.addDoneLoadingListener {
//
}
}
override fun handleChallenge(p0: AuthenticationChallenge?): AuthenticationChallengeResponse {
return AuthenticationChallengeResponse(
AuthenticationChallengeResponse.Action.CONTINUE_WITH_CREDENTIAL,
credential
)
}