diff --git a/PaymentOneAPK/src/com/nokia/example/paymentoneapk/PaymentOneAPKActivity.java b/PaymentOneAPK/src/com/nokia/example/paymentoneapk/PaymentOneAPKActivity.java index 7f12f96..b2c66c5 100644 --- a/PaymentOneAPK/src/com/nokia/example/paymentoneapk/PaymentOneAPKActivity.java +++ b/PaymentOneAPK/src/com/nokia/example/paymentoneapk/PaymentOneAPKActivity.java @@ -189,11 +189,43 @@ public class PaymentOneAPKActivity extends Activity implements ServiceConnection return; } + getPurchases(); + queryProductDetails(); buyButton.setEnabled(true); } + private void getPurchases() { + Log.d(TAG, "PaymentOneAPKActivity.getPurchases"); + + Bundle ownedItems = null; + + try { + ownedItems = mService.getPurchases(API_VERSION, getPackageName(), "inapp", null); + } catch (final RemoteException e) { + Log.e(TAG, "got an exception", e); + + return; + } + + final int response = ownedItems.getInt("RESPONSE_CODE"); + + if (response != PaymentOneAPKUtils.RESULT_OK) { + + Log.e(TAG, String.format("response code = %d : %s", response, getErrorMessage(response))); + + return; + } + + final ArrayList ownedSkus = + ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); + + for (final String ownedSku : ownedSkus) { + Log.d(TAG, "ownedSku = " + ownedSku); + } + } + private void queryProductDetails() { Log.d(TAG, "PaymentOneAPKActivity.queryProductDetails");