本文整理汇总了Java中com.amazon.device.iap.model.PurchaseUpdatesResponse.getReceipts方法的典型用法代码示例。如果您正苦于以下问题:Java PurchaseUpdatesResponse.getReceipts方法的具体用法?Java PurchaseUpdatesResponse.getReceipts怎么用?Java PurchaseUpdatesResponse.getReceipts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazon.device.iap.model.PurchaseUpdatesResponse
的用法示例。
在下文中一共展示了PurchaseUpdatesResponse.getReceipts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPurchaseUpdatesResponse
import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@Override
public void onPurchaseUpdatesResponse(PurchaseUpdatesResponse response) {
if (response.getRequestId().equals(mAlreadyPurchasedRequestId)) {
for (Receipt receipt: response.getReceipts()) {
if (receipt.getSku().equals(mAlreadyPurchasedProductId)) {
final PurchaseCallback callback = mPurchaseCallbacks.get(response.getRequestId());
if (callback != null) {
mPurchaseCallbacks.remove(response.getRequestId());
}
validatePurchase(receipt, response.getUserData().getUserId(), callback);
}
}
mAlreadyPurchasedProductId = null;
mAlreadyPurchasedRequestId = null;
}
}
示例2: getInventory
import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@NonNull
public static Collection<Purchase> getInventory(
@NonNull final PurchaseUpdatesResponse response) {
final List<Receipt> receipts = response.getReceipts();
final Collection<Purchase> purchases = new ArrayList<>(receipts.size());
for (final Receipt receipt : receipts) {
final Purchase purchase = convertPurchase(receipt);
if (purchase != null) {
purchases.add(purchase);
}
}
return purchases;
}
示例3: onPurchaseUpdatesResponse
import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@Override
public void onPurchaseUpdatesResponse(final PurchaseUpdatesResponse purchaseUpdatesResponse) {
final PurchaseUpdatesResponse.RequestStatus requestStatus = purchaseUpdatesResponse.getRequestStatus();
final RequestId requestId = purchaseUpdatesResponse.getRequestId();
Logger.d("onPurchaseUpdatesResponse() reqStatus: ", requestStatus,
"reqId: ", requestId);
switch (requestStatus) {
case SUCCESSFUL:
for (final String sku : inventory.getAllOwnedSkus()) {
inventory.erasePurchase(sku);
}
final UserData userData = purchaseUpdatesResponse.getUserData();
final String userId = userData.getUserId();
if (!userId.equals(currentUserId)) {
Logger.w("onPurchaseUpdatesResponse() Current UserId: ", currentUserId,
", purchase UserId: ", userId);
break;
}
for (final Receipt receipt : purchaseUpdatesResponse.getReceipts()) {
inventory.addPurchase(getPurchase(receipt));
}
if (purchaseUpdatesResponse.hasMore()) {
PurchasingService.getPurchaseUpdates(false);
Logger.d("Initiating Another Purchase Updates with offset: ");
return;
}
break;
case FAILED:
break;
}
final CountDownLatch countDownLatch = inventoryLatchQueue.poll();
if (countDownLatch != null) {
countDownLatch.countDown();
}
}