In-app billing v3 test purchase not working across devices

坚强是说给别人听的谎言 提交于 2019-12-07 08:00:28

问题


I have setup three Managed items in my developer account for in-app purchases, and my app is currently in the Beta channel on the Play Store.

I want to test the in-app purchase across two devices that use the same Google account -- but am finding that only the device that makes the purchase is correctly finding the purchase. The second device, using the same Google account, does not find the purchase.

Should test account billing work across any device that uses the same Google account?

I'm using the Billing helper libraries and here's my code at start-up to check for purchases:

ActivityStartUp.java

@Override
public void onIabSetupFinished(IabResult result) 
{
    if (!result.isSuccess()) 
    {
        LOGD(TAG, "In-app Billing setup failed: " + result);
        startApplication();
    } 
    else 
    {             
        LOGD(TAG, "In-app Billing is set up OK");

        // Query In-App billing for purchases
        mHelper.queryInventoryAsync(new QueryInventoryFinishedListener() 
        {
            @Override
            public void onQueryInventoryFinished(IabResult result, Inventory inv) 
            {
                if (inv.hasPurchase(Globals.ITEM1_SKU) || 
                    inv.hasPurchase(Globals.ITEM2_SKU) ||
                    inv.hasPurchase(Globals.ITEM3_SKU))
                {
                    // Store PRO purchase state
                    AccountUtils.setProVersion(ActivityStartUp.this, true);

                    LOGD(TAG, "Ad-free.  User has purchased the Upgrade :)");
                }
                else
                {
                    // Store PRO purchase state
                    AccountUtils.setProVersion(ActivityStartUp.this, false);

                    LOGD(TAG, "Using the free version, with Ads");
                }

                // Start the application
                startApplication();
            }
        });
    }
}

来源:https://stackoverflow.com/questions/26591155/in-app-billing-v3-test-purchase-not-working-across-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!