We are using ARCGIS Android SDK 100.5
We try to fetch the token using rest api
and create UserCredentials object using token and referrer (unfortunately referrer cannot be nil in Android unlike IOS).
We are assigning the credentials to an online RouteTask
val routeTask = RouteTask(appContext, "http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")
val credential = UserCredential.createFromToken(accessToken, "www.arcgis.com")
routeTask.credential = credential
We are getting exception :
"ArcGISRuntimeException: Cannot call this method in this context" whenever we try to get route parameters from routeTask.
for this method
val routeParameters = routeTask?.createDefaultParametersAsync()?.get()
Please note that we are following similar approach in IOS and it is working fine.
Any hints or suggestion on why this exception is coming?