本文整理汇总了Java中com.amazon.device.iap.model.ProductDataResponse类的典型用法代码示例。如果您正苦于以下问题:Java ProductDataResponse类的具体用法?Java ProductDataResponse怎么用?Java ProductDataResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProductDataResponse类属于com.amazon.device.iap.model包,在下文中一共展示了ProductDataResponse类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
@Override
public void onProductDataResponse(ProductDataResponse response) {
final ProductDataResponse.RequestStatus status = response.getRequestStatus();
logDebug("onProductDataResponse: RequestStatus (" + status + ")");
switch (status) {
case SUCCESSFUL:
logDebug("onProductDataResponse: successful. The item data map in this response includes the valid SKUs");
final Set<String> unavailableSkus = response.getUnavailableSkus();
logDebug("onProductDataResponse: " + unavailableSkus.size() + " unavailable skus");
Map<String, Product> productData = response.getProductData();
logDebug("onProductDataResponse productData : " + productData.size());
Map<String, String> iapkeyPrices = new HashMap<>();
for (Map.Entry<String, Product> entry : productData.entrySet()) {
Product product = productData.get(entry.getKey());
iapkeyPrices.put(product.getSku(), product.getPrice());
}
amazonBillingService.updatePrices(iapkeyPrices);
break;
case FAILED:
case NOT_SUPPORTED:
logDebug("onProductDataResponse: failed, should retry request");
break;
}
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:27,代码来源:AmazonBillingListener.java
示例2: getSkusDetails
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
@NonNull
public static Collection<SkuDetails> getSkusDetails(
@NonNull final ProductDataResponse response) {
final Collection<SkuDetails> skusDetails = new ArrayList<>();
final Collection<Product> products = response.getProductData().values();
for (final Product product : products) {
final SkuDetails skuDetails = convertSkuDetails(product);
if (skuDetails != null) {
skusDetails.add(skuDetails);
}
}
for (final String sku : response.getUnavailableSkus()) {
skusDetails.add(new SkuDetails(sku));
}
return skusDetails;
}
开发者ID:onepf,项目名称:OPFIab,代码行数:19,代码来源:AmazonUtils.java
示例3: onEventAsync
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
/**
* Handles sku details response from Amazon.
*
* @param response Response to handle.
*/
public void onEventAsync(@NonNull final ProductDataResponse response) {
final ProductDataResponse.RequestStatus status = response.getRequestStatus();
switch (status) {
case SUCCESSFUL:
final Collection<SkuDetails> skusDetails = AmazonUtils.getSkusDetails(response);
postResponse(new SkuDetailsResponse(SUCCESS, getName(), skusDetails));
break;
case FAILED:
case NOT_SUPPORTED:
OPFLog.e("Product data request failed: %s", response);
postResponse(new SkuDetailsResponse(handleFailure(), getName()));
break;
default:
OPFLog.e("Unknown status: " + status);
postResponse(new SkuDetailsResponse(UNKNOWN_ERROR, getName()));
break;
}
}
开发者ID:onepf,项目名称:OPFIab,代码行数:24,代码来源:AmazonBillingProvider.java
示例4: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
@Override
public void onProductDataResponse(@NotNull final ProductDataResponse productDataResponse) {
final ProductDataResponse.RequestStatus status = productDataResponse.getRequestStatus();
final RequestId requestId = productDataResponse.getRequestId();
Logger.d("onItemDataResponse() reqStatus: ", status,
", reqId: ", requestId);
switch (status) {
case SUCCESSFUL:
final Map<String, Product> productData = productDataResponse.getProductData();
for (final String key : productData.keySet()) {
final Product product = productData.get(key);
inventory.addSkuDetails(getSkuDetails(product));
}
break;
case FAILED:
// Fall through
case NOT_SUPPORTED:
break;
}
final CountDownLatch countDownLatch = inventoryLatchQueue.poll();
if (countDownLatch != null) {
countDownLatch.countDown();
}
}
开发者ID:onepf,项目名称:OpenIAB,代码行数:26,代码来源:AmazonAppstoreBillingService.java
示例5: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
/**
* This is the callback for {@link PurchasingService#getProductData}.
*/
@Override
public void onProductDataResponse(final ProductDataResponse response) {
final ProductDataResponse.RequestStatus status = response.getRequestStatus();
showMessage(LOGTYPELOG, "onProductDataResponse: RequestStatus (" + status + ")");
switch (status) {
case SUCCESSFUL:
showMessage(LOGTYPELOG, "onProductDataResponse: successful");
// Store product information
Map<String, Product> availableSkus = response.getProductData();
showMessage(LOGTYPELOG, "onProductDataResponse: " + availableSkus.size() + " available skus");
for (Entry<String, Product> entry : availableSkus.entrySet()) {
informationMap.put(entry.getKey(), AmazonTransactionUtils.convertProductToInformation(entry.getValue()));
}
final Set<String> unavailableSkus = response.getUnavailableSkus();
showMessage(LOGTYPELOG, "onProductDataResponse: " + unavailableSkus.size() + " unavailable skus");
for (String sku : unavailableSkus) {
showMessage(LOGTYPELOG, "onProductDataResponse: sku " + sku + " is not available");
}
break;
case FAILED:
case NOT_SUPPORTED:
showMessage(LOGTYPEERROR, "onProductDataResponse: failed, should retry request");
break;
}
}
开发者ID:libgdx,项目名称:gdx-pay,代码行数:33,代码来源:PurchaseManagerAndroidAmazon.java
示例6: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
/**
* see parent (or https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs/quick-start)
*/
@Override
public void onProductDataResponse(ProductDataResponse productDataResponse) {
IabResult result = null;
switch (productDataResponse.getRequestStatus()) {
case SUCCESSFUL:
String unskus = "";
for (final String s : productDataResponse.getUnavailableSkus()) {
unskus += s + "/";
}
if (!TextUtils.isEmpty(unskus)) {
Log.d(TAG, "(onItemDataResponse) The following skus were unavailable: " + unskus);
}
final Map<String, Product> products = productDataResponse.getProductData();
for (final String key : products.keySet()) {
Product product = products.get(key);
String currencyCode = "";
long priceMicros = 0;
SkuDetails skuDetails = new SkuDetails(ITEM_TYPE_INAPP,
product.getSku(), product.getPrice(), product.getTitle(), product.getDescription(), priceMicros, currencyCode);
mInventory.addSkuDetails(skuDetails);
Log.d(TAG, String.format("Product: %s\n Type: %s\n SKU: %s\n Price: %s\n Description: %s\n",
product.getTitle(), product.getProductType(), product.getSku(), product.getPrice(), product.getDescription()));
}
result = new IabResult(BillingResponse.BILLING_RESPONSE_RESULT_OK,"");
break;
case FAILED: // Fail gracefully on failed responses.
result = new IabResult(BillingResponse.BILLING_RESPONSE_RESULT_ERROR,
"Couldn't complete refresh operation.");
// Log.v(TAG, "ItemDataRequestStatus: FAILED");
break;
}
mLastResult = result;
synchronized(mLock) {
mLock.notify();
}
}
开发者ID:archos-sa,项目名称:aos-Video,代码行数:47,代码来源:AmazonIabHelper.java
示例7: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
@Override
public void onProductDataResponse(ProductDataResponse response) {
final ArrayList<InAppProduct> products = new ArrayList<InAppProduct>();
Error error = null;
switch (response.getRequestStatus()) {
case SUCCESSFUL:
Map<String, Product> items = response.getProductData();
for (String key : items.keySet()) {
Product i = items.get(key);
InAppProduct product = new InAppProduct();
product.productId = i.getSku();
product.title = i.getTitle();
product.description = i.getDescription();
String localizedPrice = i.getPrice();
String price = localizedPrice.replaceAll("[^\\d.]", "");
try {
product.price = Double.parseDouble(price);
}
catch (Exception ex) {
ex.printStackTrace();
}
product.localizedPrice = localizedPrice;
products.add(product);
}
break;
case FAILED:
error = new Error(0, "Products information could not be retrieved");
break;
case NOT_SUPPORTED:
error = new Error(0, "Products information not supported");
break;
}
final Error finalError = error;
dispatchCallback(new Runnable() {
@Override
public void run() {
mFetchCallback.onComplete(products, finalError);
mFetchCallback = null;
}
});
}
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:49,代码来源:AmazonInAppService.java
示例8: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
@Override
public void onProductDataResponse(@NonNull final ProductDataResponse productDataResponse) {
OPFIab.post(productDataResponse);
}
开发者ID:onepf,项目名称:OPFIab,代码行数:5,代码来源:AmazonBillingHelper.java
示例9: onProductDataResponse
import com.amazon.device.iap.model.ProductDataResponse; //导入依赖的package包/类
/**
* see parent (or https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs/quick-start)
*/
@Override
public void onProductDataResponse(ProductDataResponse productDataResponse) {
switch (productDataResponse.getRequestStatus()) {
case SUCCESSFUL:
String unskus = "";
for (final String s : productDataResponse.getUnavailableSkus()) {
unskus += s + "/";
}
if (!TextUtils.isEmpty(unskus)) {
SoomlaUtils.LogError(TAG, "(onItemDataResponse) The following skus were unavailable: " + unskus);
}
final Map<String, Product> products = productDataResponse.getProductData();
IabInventory inventory = new IabInventory();
for (final String key : products.keySet()) {
Product product = products.get(key);
String currencyCode = AmazonIabUtils.getCurrencyCode(mCurrentUserData.getMarketplace());
long priceMicros = AmazonIabUtils.getPriceAmountMicros(product.getPrice());
IabSkuDetails skuDetails = new IabSkuDetails(ITEM_TYPE_INAPP,
product.getSku(), product.getPrice(), product.getTitle(), product.getDescription(), priceMicros, currencyCode);
inventory.addSkuDetails(skuDetails);
SoomlaUtils.LogDebug(TAG, String.format("Product: %s\n Type: %s\n SKU: %s\n Price: %s\n Description: %s\n",
product.getTitle(), product.getProductType(), product.getSku(), product.getPrice(), product.getDescription()));
}
AmazonIabHelper.this.fetchSkusDetailsSuccess(inventory);
break;
case FAILED: // Fail gracefully on failed responses.
IabResult result = new IabResult(IabResult.BILLING_RESPONSE_RESULT_ERROR,
"Couldn't complete refresh operation.");
AmazonIabHelper.this.fetchSkusDetailsFailed(result);
// Log.v(TAG, "ItemDataRequestStatus: FAILED");
break;
}
}
开发者ID:soomla,项目名称:android-store-amazon,代码行数:45,代码来源:AmazonIabHelper.java
注:本文中的com.amazon.device.iap.model.ProductDataResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论