Added simple getPurchase example

This commit is contained in:
Timo Reunanen 2014-06-03 12:29:40 +03:00
Родитель 8ff39cd185
Коммит 370532605b
1 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -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<String> 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");