Ideas to get a call back/promise/fufillment type thing from an Async Backendless Method

Hi Backendless. Not really a backendless question, but I just can’t get this to do what I want. (forgive me not a full time Android dev!)

I have a suspend function in a kotlin class. To keep things concise it is something like this

suspend fun backendlessRequest()  {

        val dataQuery = DataQueryBuilder.create()
        var queryBuilder = LoadRelationsQueryBuilder.of(BackendlessUser::class.java)
        queryBuilder.setRelationName("leaderOf")

        val parentObjectId: String = "xxxxx"
        val dataStore = Backendless.Data.of("Users")

        dataStore.loadRelations(parentObjectId,queryBuilder,
                object : AsyncCallback<List<BackendlessUser?>> {
                    override fun handleResponse(foundUsers: List<BackendlessUser?>?) {
                       /* users successfully returned here.
                          but how can I advise the calling class that this has now been done?
                          bit like a 'fulfill' in PromiseKit Swift
                       */
                    }

                    override fun handleFault(fault: BackendlessFault?) {
                        /* and how could I tell calling class that there was a problem?
                        */
                    }
                }) 
}

Now from another class I call this sucessfully

  fun callBackendlessRequest(){
     
        scope.launch(Dispatchers.Main){

             val done = async(Dispatchers.IO) {
                    theOtherClass.backendlessRequest()
              }

         done.await()!!

         /* now I want to wait here, until I have fulfilled the backendless request
          understandably the code does not wait

          I want to use the async backendless code, but do not want to put code
         in the handlessResponse in the callback 

         but put it here, but how can I do this? (I can achive this using promiseKit in Swift)

         */


        }

I hope this makes sense. I know not strictly a backendless question, but any help or ideas to put me on the right lines would be great backendless team!!

Hi, @mike-turner

We are looking into your problem, will get back when we find any solution for you.

Regards,
Serhiy