In my application, i have implement InAppBilling (V3)
Feature...
if i Logged in *abc@gmail.com*
account in Device A , then purchased
item from my application , and then if i call getPurchase()
method
then it will return purchased item ..
if i Logged in Device B
with same account it and if i call getPurchase()
then it will not
display the item which i already purchased in Device A ..
private void checkownedItems() {
try {
Bundle ownedItems = mService.getPurchases(3, getPackageName(),"inapp", null);
if (ownedItems.getInt("RESPONSE_CODE") == 0) {
ArrayList < String > ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
ArrayList < String > purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
ArrayList < String > signatureList = ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE");
String continuationToken = ownedItems.getString("INAPP_CONTINUATION_TOKEN");
if (purchaseDataList.size() > 0) {
// Item(s) owned
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
// String signature = signatureList.get(i); // Note
// signatures
// do not
// appear to
// work with
// android.test.purchased
// (silly
// google)
String sku = ownedSkus.get(i);
Log.e("----->>", purchaseData + " --- " + " --- " + sku);
}
} else {
// Item(s) not owned
Toast.makeText(this, "No any Item is purchased",
Toast.LENGTH_SHORT).show();
}
} else {
// Error checking owned items
}
} catch (RemoteException e) {
e.printStackTrace();
}
}