这个
Tasks
类包含静态
await
方法-在Java中,我正在执行以下操作:
GoogleSignInClient googleSignInClient = GoogleSignIn.getClient(context, gso);
Task<GoogleSignInAccount> task = googleSignInClient.silentSignIn();
try {
GoogleSignInAccount account = Tasks.await(task);
...
} catch (ExecutionException e) {
// task failed
} catch (InterruptedException e) {
// an interrupt occurred while waiting for the task to finish
}