use of com.bitmonet.BitmonetPaymentStatusListener in project coinbase-bitmonet-sdk by coinbase.
the class CoinbasePaymentProcessor method checkWalletAndSendMoney.
public void checkWalletAndSendMoney(Context context, String item, double amount) {
// Check if there is a valid receiving address
if (UserProfileSettings.getInstance().retrieveMerchantReceivingAddress() == null) {
((BitmonetPaymentStatusListener) context).paymentFailure(getErrorsAarrayFromString(Constants.ERROR_INVALID_RECEIVING_ADDRESS));
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(URLUtils.constructBitcoinIntentURL(amount)));
// Check if there a wallet to handle the intent
PackageManager manager = context.getPackageManager();
List<ResolveInfo> activities = manager.queryIntentActivities(intent, 0);
if (activities.size() > 0) {
context.startActivity(intent);
} else {
showModalAndTransferMoney(context, item, amount);
}
}
Aggregations