I'm developing an application that uses the new Paypal-Android integration SDK. The application has a donation button that donates the money for an organization that supports/protects the Human Rights (No app features are added upon donating).
I followed the guidelines/example given by Paypal on Github but I'm facing a problem. My application's screen turns black and just freezes until I get a "Application Not Responding" and the app crashes. After some debugging it appeared that the problem happens right when I start the PayPal service. Below are the major snapshots of my code, any help would be appreciated.
Note: I tried using it in all environments, (No Network, Sandbox and Production) with the Test and Production Paypal accounts, but it constantly gives the same error.
Thaks in advance.
Donation Activity:
private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_SANDBOX;
private static final String MERCHANT_NAME = "*****";
private static final String RECEIVER_CLIENT_ID = "*****";
private static PayPalConfiguration config = new PayPalConfiguration().environment(CONFIG_ENVIRONMENT)
.clientId(RECEIVER_CLIENT_ID)
.merchantName(MERCHANT_NAME);
// Paypal service intent
private Intent paypalServiceIntent;
// onCreate
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donation_layout);
// Init Params
initParams();
}
// initParams
private void initParams()
{
// Initialize the service
paypalServiceIntent = new Intent(this, PayPalService.class);
// Star the Paypal service
paypalServiceIntent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(paypalServiceIntent);
}
Manifest:
<!-- Paypal Activities/Services -->
<activity android:name="com.paypal.android.sdk.payments.PaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.LoginActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" />
<service
android:name="com.paypal.android.sdk.payments.PayPalService"
android:exported="false" />