Ce qui suit montre mon code utilisé pour initialiser un objet paypal dans mon application android. L'erreur d'exécution est due à doInBackground(), donc je pense que c'est probablement dû à false retourné par payPal.isLibraryInitialized(). Avez-vous l'expérience de l'intégration paypal dans l'application android?paiement android paypal in-app: n'a pas réussi à initialiser la bibliothèque paypal
private class PayPalInitializer extends AsyncTask<Void, Void, Boolean> {
private static final String APP_ID = "APP-80W284485P519543T";
private Context mContext;
private ProgressDialog mProgressDialog;
public PayPalInitializer(Context context) {
mContext = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = new ProgressDialog(mContext);
mProgressDialog.setMessage("...");
mProgressDialog.show();
}
@Override
protected Boolean doInBackground(Void... params) {
boolean success = false;
PayPal payPal = PayPal.getInstance();
if (payPal == null) {
payPal = PayPal.initWithAppID(mContext, APP_ID, PayPal.ENV_SANDBOX);
payPal.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER);
// Set to true if the transaction will require shipping.
payPal.setShippingEnabled(true);
if (payPal.isLibraryInitialized()) {
success = true;
}
}
return success;
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
mProgressDialog.hide();
mProgressDialog = null;
if (result) {
setupButton();
} else {
Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
}
}
};
trouvé erreur « Impossible de trouver la classe « com.paypal.android.MEP.PayPalPayment », référencé à partir de la méthode ... » avant la doInBackground .. ce que j'ai inclus dans mon projet est PayPal_MPL.jar téléchargé de x.com ... – Henry