Search in sources :

Example 1 with BitmonetPaymentStatusListener

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);
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) BitmonetPaymentStatusListener(com.bitmonet.BitmonetPaymentStatusListener) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 BitmonetPaymentStatusListener (com.bitmonet.BitmonetPaymentStatusListener)1