Asynchronous Execution of Operations

Asynchronous Execution of Operations

You can execute Backend Services Android SDK operations asynchronously. Asynchronous calls are handled by an abstract callback class.

You will notice that each facade has a method that allows asynchronous execution. Asynchronous calls are handled by an abstract callback class RequestResultCallbackAction<T> which has only method invoke() which accepts RequestResult as parameter.

executeAsync(new RequestResultCallbackAction<ArrayList<Activity>>() {
        public void invoke(RequestResult<ArrayList<Activity>> requestResult) {
            if (requestResult.getSuccess()) {
                for (Activity activity : requestResult.getValue()) {
            } else {

As you can see both classes RequestResultCallbackAction<T> and RequestResult<T> are generic which allows to put some "syntax sugar" in the code.

You can call executeAsync() method without parameters in cases when you do not need to handle the result (or it is expected to be null). The best example for this is the LogoutFacade which generally cannot get wrong. ​


Be aware that by default all asynchronous calls are executed as daemon threads which means that execution will be interrupted when parent application stops. In order to override this behavior just use the overload method executeAsync(RequestResultCallbackAction<T>, executeAsDaemon).

app.workwith().authentication().logout().executeAsync(null, false);
Start a free trial Request a demo
Contact us: +1-888-365-2779
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.