In-app billing v3 unable to query items without network connection or in airplane/flight mode

后端 未结 4 836
长发绾君心
长发绾君心 2020-12-06 02:14

Going through the v3 example file in modifying it with my project works fine. However my friend just tested the code by turning wi-fi off and turning on airplane mode. This

4条回答
  •  离开以前
    2020-12-06 02:35

    I think I may have found the answer. In following v3's TrivialDriveExample I was calling the queryInventoryAsync function in the mHelper.startSetup() function like so:

    Log.d(TAG, "Setup successful. Querying inventory.");
    mHelper.queryInventoryAsync(mGotInventoryListener);
    

    Instead now I'm passing a String array list of my SKUs that I want to query for:

    List skulist = new ArrayList();
    skulist.add("my_sku_name1");
    skulist.add("my_sku_name2");
    mHelper.queryInventoryAsync(true, skulist, mGotInventoryListener);
    

    I then tested by turning on flight mode and I was able to query my purchases fine!

提交回复
热议问题