本文整理汇总了Java中com.google.android.gms.tasks.Tasks.call方法的典型用法代码示例。如果您正苦于以下问题:Java Tasks.call方法的具体用法?Java Tasks.call怎么用?Java Tasks.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.tasks.Tasks
的用法示例。
在下文中一共展示了Tasks.call方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteCollection
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
/**
* Delete all documents in a collection. Uses an Executor to perform work on a background
* thread. This does *not* automatically discover and delete subcollections.
*/
private static Task<Void> deleteCollection(final CollectionReference collection,
final int batchSize,
Executor executor) {
// Perform the delete operation on the provided Executor, which allows us to use
// simpler synchronous logic without blocking the main thread.
return Tasks.call(executor, () -> {
// Get the first batch of documents in the collection
Query query = collection.orderBy("__name__").limit(batchSize);
// Get a list of deleted documents
List<DocumentSnapshot> deleted = deleteQueryBatch(query);
// While the deleted documents in the last batch indicate that there
// may still be more documents in the collection, page down to the
// next batch and delete again
while (deleted.size() >= batchSize) {
// Move the query cursor to start after the last doc in the batch
DocumentSnapshot last = deleted.get(deleted.size() - 1);
query = collection.orderBy("__name__")
.startAfter(last.getId())
.limit(batchSize);
deleted = deleteQueryBatch(query);
}
return null;
});
}
示例2: asyncGetRegisterRequest
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<RegisterRequestParams> asyncGetRegisterRequest(final Boolean allowReregistration) {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<RegisterRequestParams>() {
@Override
public RegisterRequestParams call() throws Exception {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.getRegistrationRequest(allowReregistration);
}
});
}
示例3: asyncUpdateRegisterResponseToServer
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<String> asyncUpdateRegisterResponseToServer(
final RegisterResponseData registerResponseData) {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<String>() {
@Override
public String call() throws Exception {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.getRegisterResponseFromServer(registerResponseData);
}
});
}
示例4: asyncGetSignRequest
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<SignRequestParams> asyncGetSignRequest() {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<SignRequestParams>() {
@Override
public SignRequestParams call() throws Exception {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.getSignRequest();
}
});
}
示例5: asyncUpdateSignResponseToServer
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<String> asyncUpdateSignResponseToServer(final SignResponseData signResponseData) {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<String>() {
@Override
public String call() throws Exception {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.getSignResponseFromServer(signResponseData);
}
});
}
示例6: asyncRefreshSecurityKey
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<List<Map<String, String>>> asyncRefreshSecurityKey() {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<List<Map<String, String>>>() {
@Override
public List<Map<String, String>> call() {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.getAllSecurityTokens();
}
});
}
示例7: asyncRemoveSecurityKey
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
private Task<String> asyncRemoveSecurityKey(final int tokenPositionInList) {
return Tasks.call(THREAD_POOL_EXECUTOR, new Callable<String>() {
@Override
public String call() {
gaeService = GAEService.getInstance(U2FDemoActivity.this, mGoogleSignInAccount);
return gaeService.removeSecurityKey(securityTokens.get(tokenPositionInList)
.get(KEY_PUB_KEY));
}
});
}
示例8: deleteCollection
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
/**
* Delete all documents in a collection. Uses an Executor to perform work on a background
* thread. This does *not* automatically discover and delete subcollections.
*/
private Task<Void> deleteCollection(final CollectionReference collection,
final int batchSize,
Executor executor) {
// Perform the delete operation on the provided Executor, which allows us to use
// simpler synchronous logic without blocking the main thread.
return Tasks.call(executor, new Callable<Void>() {
@Override
public Void call() throws Exception {
// Get the first batch of documents in the collection
Query query = collection.orderBy(FieldPath.documentId()).limit(batchSize);
// Get a list of deleted documents
List<DocumentSnapshot> deleted = deleteQueryBatch(query);
// While the deleted documents in the last batch indicate that there
// may still be more documents in the collection, page down to the
// next batch and delete again
while (deleted.size() >= batchSize) {
// Move the query cursor to start after the last doc in the batch
DocumentSnapshot last = deleted.get(deleted.size() - 1);
query = collection.orderBy(FieldPath.documentId())
.startAfter(last.getId())
.limit(batchSize);
deleted = deleteQueryBatch(query);
}
return null;
}
});
}
示例9: deleteCollection
import com.google.android.gms.tasks.Tasks; //导入方法依赖的package包/类
/**
* Delete all documents in a collection. Uses an Executor to perform work on a background
* thread. This does *not* automatically discover and delete subcollections.
*/
private static Task<Void> deleteCollection(final CollectionReference collection,
final int batchSize,
Executor executor) {
// Perform the delete operation on the provided Executor, which allows us to use
// simpler synchronous logic without blocking the main thread.
return Tasks.call(executor, new Callable<Void>() {
@Override
public Void call() throws Exception {
// Get the first batch of documents in the collection
Query query = collection.orderBy("__name__").limit(batchSize);
// Get a list of deleted documents
List<DocumentSnapshot> deleted = deleteQueryBatch(query);
// While the deleted documents in the last batch indicate that there
// may still be more documents in the collection, page down to the
// next batch and delete again
while (deleted.size() >= batchSize) {
// Move the query cursor to start after the last doc in the batch
DocumentSnapshot last = deleted.get(deleted.size() - 1);
query = collection.orderBy("__name__")
.startAfter(last.getId())
.limit(batchSize);
deleted = deleteQueryBatch(query);
}
return null;
}
});
}