views:

207

answers:

0

All right all you android guys, I'm trying to integrate the Paypal API to make my app donations based. 2 questions:

  1. I can see the button, I click it, and it doesn't do anything! (the activity for checkoutIntent doesn't fire?)

  2. What are your experiences with donation based android apps? I want to make about $250 a month of this thing, is that even possible?

` package com.projects.magic;

import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RelativeLayout;

import com.paypal.android.MEP.CheckoutButton; import com.paypal.android.MEP.PayPal; import com.paypal.android.MEP.PayPalActivity; import com.paypal.android.MEP.PayPalPayment; import com.paypal.android.MEP.MEPAddress; import com.paypal.android.MEP.PaymentAdjuster; import com.paypal.android.MEP.MEPAmounts;

public class Donate extends Activity implements OnClickListener{

PayPal ppObj = PayPal.initWithAppID(this.getBaseContext(), "APP-80W284485P519543T", PayPal.ENV_SANDBOX);

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.donate); LinearLayout mainLayout = (LinearLayout)findViewById(R.id.LinearLayout01); if (ppObj == null) ppObj = PayPal.initWithAppID(this.getBaseContext(), "APP-80W284485P519543T", PayPal.ENV_SANDBOX); CheckoutButton payPalButton = (CheckoutButton) ppObj.getPaymentButton(PayPal.BUTTON_294x45, this, PayPal.PAYMENT_TYPE_HARD_GOODS); payPalButton.setOnClickListener(this); mainLayout.addView(payPalButton); }

public void onClick(View arg0) { PayPalPayment newPayment = new PayPalPayment(); newPayment.setAmount((float) 1.00); newPayment.setCurrency("USD"); newPayment.setRecipient("[email protected]"); Intent checkoutIntent = new Intent(this, PayPalActivity.class); checkoutIntent.putExtra(PayPalActivity.EXTRA_PAYMENT_INFO, newPayment);

this.startActivityForResult(checkoutIntent, 1); }

@Override public void onBackPressed() { Intent menuIntent = new Intent(Donate.this, MTGTools.class); this.startActivity(menuIntent); } }