0

Amazon In App 已集成到我的游戏应用程序中。但由于 In App 购买失败,在 Amazon Distribution Portal 上提交的应用程序已被拒绝。

问题通常是应用内购买失败并报告错误“购买物品时出错”。

我试图找出问题,但无法这样做。我尝试使用 AmazonSDKTester.apk 和 amazon.sdktester.json 进行测试

亚马逊应用内购买中描述 ,一切正常。但在实际环境中,问题就出现了。有没有人遇到过同样的问题?或关于问题/解决方案的任何想法?

4

1 回答 1

1

以下代码对我来说很好。您可以随时向亚马逊的支持部门发送电子邮件,询问有关您的 IAP 提交失败的原因的详细信息。另外,发布您的代码,然后我们可以看到缺少的内容。当您在 Kindle 和其他 Android 设备(摩托罗拉 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 ... 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>
于 2012-10-15T05:19:08.567 回答