PoiCallback Interface
The interface for creating a callback to receive Naurt POIs.
Import
Kotlin
import com.naurt.sdk.poi.PoiCallback
Signature
Kotlin
interface PoiCallback<JSONObject> {
/**
* Callback for API response
*
* This function will be called when a Naurt API has responded.
*
*/
fun onComplete(result: NaurtResult<JSONObject>)
}
Parameters
result
: A NaurtResult which can either be a success or a failure depending on the result of the web request. A success will contain a JSON response. A failure will contain a status code and a JSON response.
Example
Kotlin
import com.naurt.sdk.poi.PoiCallback
import com.naurt.sdk.enums.NaurtResult
class MyNaurtCallback() : PoiCallback<JSONObject> {
override fun onComplete(result: NaurtResult<JSONObject>) {
when (result) {
is NaurtResult.Success -> {
println("Success!: ${result.value}")
}
is NaurtResult.Failure -> {
println("Oh no, an Error! Code: ${result.code}, Message: ${result.message}")
}
}
}
}
Table of Contents