use of com.google.android.gms.common.api.BooleanResult in project connect-sdk-client-android by Ingenico-ePayments.
the class AndroidPayUtil method isAndroidPayAllowed.
private static boolean isAndroidPayAllowed(Collection<Integer> networks, Context context, C2sCommunicator communicator) {
GoogleApiClient client = new GoogleApiClient.Builder(context).addApi(Wallet.API, new Wallet.WalletOptions.Builder().setEnvironment(getWalletEnvironment(communicator)).build()).build();
client.connect();
IsReadyToPayRequest request = createIsReadyToPayRequest(networks);
PendingResult<BooleanResult> result = Wallet.Payments.isReadyToPay(client, request);
BooleanResult actualResult = result.await(Constants.ACCEPTABLE_WAIT_TIME_IN_MILISECONDS, TimeUnit.MILLISECONDS);
if (actualResult.getStatus().isSuccess()) {
return actualResult.getValue();
} else {
Log.e(TAG, "Error while making isReadyToPay call: " + actualResult.getStatus());
return false;
}
}
Aggregations