Amazon In App已集成到我的游戏应用程序中。但由于In App购买失败,Amazon Distribution Portal上的应用程序提交被拒绝。
问题通常是In App购买失败,因为报告错误“购买商品时出错”。
我试图找出问题,但无法解决。香港专业教育学院尝试使用 AmazonSDKTester.apk 和amazon.sdktester.json
在Amazon In-app purchase处描述 一切正常。但在实际环境中,问题就出现了。有没有人遇到同样的问题?或任何有关问题/解决方案的想法?
答案 0 :(得分:1)
以下代码适用于我。您可以随时通过电子邮件向亚马逊的支持人员询问有关IAP失败提交原因的详细信息。另外,发布您的代码,然后我们可以看到缺少的内容。当您在Kindle和其他Android设备(Motorola Droid,HTC等)上进行测试时,您必须确保IAP正常工作或退出。
private class AmazonPurchasingObserver extends BasePurchasingObserver
{
public AmazonPurchasingObserver()
{
super(oThis);
}
@Override
public void onItemDataResponse(ItemDataResponse itemDataResponse)
{
//Check itemDataResponse.getItemDataRequestStatus();
//Use itemDataResponse to populate catalog data
// Didn't use, items have already been stored locally in the game localization xml
}
@Override
public void onPurchaseResponse(PurchaseResponse purchaseResponse)
{
PurchaseRequestStatus status = purchaseResponse.getPurchaseRequestStatus();
Log.d(sTag, "status: " + status.name());
if (status == PurchaseRequestStatus.SUCCESSFUL)
{
//If SUCCESSFUL, fulfill content;
Receipt purchaseReceipt = purchaseResponse.getReceipt();
String sku = purchaseReceipt.getSku();
successBoughtProduct(sku); // implement the logic you need when a product is successfully bought, ie: increment game scores, save game states, etc.
Log.d(sTag, "SUCCESS: " + sku);
}
else
{
failToBuyProduct(); // implement your own logic to deal with failures
Log.d(sTag, "FAILED purchase");
}
}
}
public static void amazonPurchaseRequest(String productSku)
{
Log.d(sTag, "amazonPurchaseRequest: " + productSku);
PurchasingManager.initiatePurchaseRequest(productSku);
}
在AndroidManifest.xml中的“application”标签内,添加:
<application ... etc
<receiver android:name = "com.amazon.inapp.purchasing.ResponseReceiver" >
<intent-filter>
<action android:name = "com.amazon.inapp.purchasing.NOTIFY"
android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
</application>