@Override public void finish() { if (handler != null && payMent.getMessage() != null) { handler.sendMessageDelayed(payMent.getMessage(), 800); } super.finish(); }
public void onConsumeFinished(Purchase purchase, IabResult result) { Log.e(TAG, "Consumption finished. Purchase: " + purchase + ", result: " + result); // We know this is the "gas" sku because it's the only one we // consume, // so we don't check which sku was consumed. If you have more than // one // sku, you probably should check... if (result.isSuccess()) { // successfully consumed, so we apply the effects of the item in // our // game world's logic, which in our case means filling the gas // tank a bit Log.e(TAG, "支付成功"); payMent.onSucess(item); finish(); } else { Log.e(TAG, "支付失败"); mHelper.consumeAsync(purchase, mConsumeFinishedListener); complain("Error while consuming: " + result); } Log.e(TAG, "End consumption flow."); }
void complain(String message) { payMent.onFailed(item); // Toast.makeText(this, message, Toast.LENGTH_LONG).show(); Log.e(TAG, "**** TrivialDrive Error: " + message); }
private static void pay(Activity ctx, String item) { Intent intent = new Intent(ctx, Pay.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(PARAM_ITEM, payMent.convertItem(item)); ctx.startActivity(intent); }