如何检测用户是否在点燃火上取消了IAP?

编程入门 行业动态 更新时间:2024-10-20 01:32:29
本文介绍了如何检测用户是否在点燃火上取消了IAP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

之前可能已经问过这个问题,但我无法在任何地方找到答案,我不知道亚马逊IAP SDK是否可行。 当我取消购买时,我将从购买回复中收到 FAILED 。 如果是这样,我如何显示 FAILED是由取消或其他无关环境错误造成的?

This question might have been asked before, but I can't find the answer anywhere and I don't know if it is possible for the Amazon IAP SDK. When I canceled a purchase, I will be received as FAILED from purchase response. If so, how can I display the FAILED is caused by cancellation or other extraneous circumstance error?

private class PurchaseAsyncTask extends AsyncTask<PurchaseResponse, Void, Boolean> { private String [] purchaseResult = null; @Override protected Boolean doInBackground(final PurchaseResponse... params) { final PurchaseResponse purchaseResponse = params[0]; final String userId = microTrans.getCurrentUser(); switch (purchaseResponse.getPurchaseRequestStatus()) { case SUCCESSFUL: /* * You can verify the receipt and fulfill the purchase on * successful responses. */ final Receipt receipt = purchaseResponse.getReceipt(); switch (receipt.getItemType()) { case CONSUMABLE: break; case ENTITLED: break; case SUBSCRIPTION: break; } return true; case ALREADY_ENTITLED: /* * If the customer has already been entitled to the item, a * receipt is not returned. Fulfillment is done unconditionally, * we determine which item should be fulfilled by matching the * request id returned from the initial request with the request * id stored in the response. */ // TODO handle already entitled Log.v(TAG, "already entitled!"); return true; case FAILED: /* * If the purchase failed for some reason, (The customer * canceled the order, or some other extraneous circumstance * happens) the application ignores the request and logs the * failure. */ // TODO handle failed of purchase Log.v(TAG, "Failed purchase for request" + purchaseResponse.getRequestId()); return false; case INVALID_SKU: /* * If the sku that was purchased was invalid, the application * ignores the request and logs the failure. This can happen * when there is a sku mismatch between what is sent from the * application and what currently exists on the dev portal. */ // TODO handle invalid sku Log.v(TAG, "Invalid Sku for request " + purchaseResponse.getRequestId()); return false; } return false; } @Override protected void onPostExecute(final Boolean success) { super.onPostExecute(success); } }

推荐答案

那里无法区分取消和其他类型的失败。

There is no way to distinguish between cancellation and other type of failures.

但是,每亚马逊IAP用户体验指南:

您的应用不应尝试向客户发送任何交易状态或状态。 In-App Purchasing API将处理所有确认和向客户发送消息,包括交易成功和失败消息。

Your app should not attempt to message any transaction state or status to the customer. In-App Purchasing API will handle all confirmations and messaging to the customer, including transaction success and failure messages.

更多推荐

如何检测用户是否在点燃火上取消了IAP?

本文发布于:2023-11-27 09:15:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637463.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:火上   用户   取消了   IAP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!