public void blockingTask()

in tasks/app/src/main/java/com/google/firebase/quickstart/tasks/MainActivity.java [174:204]


    public void blockingTask() {
        // [START blocking_task]
        try {
            // Block on a task and get the result synchronously. This is generally done
            // when executing a task inside a separately managed background thread. Doing this
            // on the main (UI) thread can cause your application to become unresponsive.
            AuthResult authResult = Tasks.await(task);
        } catch (ExecutionException e) {
            // The Task failed, this is the same exception you'd get in a non-blocking
            // failure handler.
            // ...
        } catch (InterruptedException e) {
            // An interrupt occurred while waiting for the task to complete.
            // ...
        }
        // [END blocking_task]

        // [START blocking_task_timeout]
        try {
            // Block on the task for a maximum of 500 milliseconds, otherwise time out.
            AuthResult authResult = Tasks.await(task, 500, TimeUnit.MILLISECONDS);
        } catch (ExecutionException e) {
            // ...
        } catch (InterruptedException e) {
            // ...
        } catch (TimeoutException e) {
            // Task timed out before it could complete.
            // ...
        }
        // [END blocking_task_timeout]
    }