I implemented in-app billing in Android application, have like 6 product they are like coins the user will buy in order to buy items in my app. The setup and the testing for
Since you're consuming multiple items, would suggest to use consumeAsync for multiple items method by passing your list of purchases. You can find it inside TrivialDrive sample app for Iab ver 3
/**
* Same as {@link consumeAsync}, but for multiple items at once.
* @param purchases The list of PurchaseInfo objects representing the purchases to consume.
* @param listener The listener to notify when the consumption operation finishes.
*/
public void consumeAsync(List<Purchase> purchases, OnConsumeMultiFinishedListener listener) {
Use onConsumeMultiFinished as your callback
public void onConsumeMultiFinished(List<Purchase> purchases, List<IabResult> results);
It should take care of sending proper async consume requests. Update you code and post any problems.
change your class to these
public class BankClass {
public int itemId;
public int quantity;
public String Price;
public BankClass(int _itemId,int _quantity,String _Price){
itemId = _itemId;
quantity = _quantity;
Price = _Price;
}
public int getItemId() {
return itemId;
}
public String getPrice() {
return Price;
}
public int getQuantity() {
return quantity;
}
}
in listitem click change these all code like bewlo
BankClass currentItem = BankList.get(position);
CoinItemID = currentItem.getItemId();
if (currentItem.getQuantity() == 100)
{
CoinItemID = currentItem.getItemId();
String payload = "";
mHelper.launchPurchaseFlow(BankActivity.this, SKU_hundred, RC_REQUEST,
mPurchaseFinishedListener, payload);
}