未找到inapp产品

时间:2014-12-29 10:43:52

标签: android in-app-purchase in-app-billing in-app

我对Android inapp购买感到疯狂。

我检查了所有可以找到的SO帖子,检查并重新检查应用和控制台设置中的所有内容。我有正确的软件包名称,我有正确的许可证密钥,相同的apk上传和安装在设备上,测试帐户设置并用作主要,甚至在设备上进行了工厂恢复,以及所有其余...

但无济于事:它只是继续回应

无法找到您尝试购买的商品

控制台中没有任何内容。找到原因很少失去...

mPurchaseFinishedListener 
       = new IabHelper.OnIabPurchaseFinishedListener() {
       public void onIabPurchaseFinished(IabResult result, Purchase purchase) 
       {
          if (result.isFailure()) {
             Log.d("4357", "Error purchasing: " + result);
             return;
          }      
          else  
              provideContent(purchase.getSku(),"");
          }
    };


       mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
       public void onQueryInventoryFinished(IabResult result, Inventory inventory)   
       {
          if (result.isFailure()) {
              Toast.makeText(MainActivity.this, "Failure!", Toast.LENGTH_LONG).show();
             return;
           }
          SkuDetails test=inventory.getSkuDetails("dig5");
          if(test == null){
              Toast.makeText(MainActivity.this, "NOTHING!", Toast.LENGTH_LONG).show();
              return;
          }
          String dig5 =
                  inventory.getSkuDetails("dig5").getPrice();
          String dig6 =
                          inventory.getSkuDetails("dig6").getPrice();

          String seesolution =
              inventory.getSkuDetails("seesolution").getPrice();


           // update the UI 
       }
    };

    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
           public void onIabSetupFinished(IabResult result) {
              if (!result.isSuccess()) {
                 // Oh noe, there was a problem.
                 Log.d("4357", "Problem setting up In-app Billing: " + result);
              }
                 // Hooray, IAB is fully set up!
              //ArrayList <String> additionalSkuList = new ArrayList<String>();
              ArrayList <String> additionalSkuList           = new ArrayList<String>();
                additionalSkuList.add("seesolution");
                additionalSkuList.add("dig5");
                additionalSkuList.add("dig6");
                mHelper.queryInventoryAsync(true, additionalSkuList,
                   mQueryFinishedListener);
           }
        });

1 个答案:

答案 0 :(得分:0)

如果控制台中的应用程序内项目处于活动状态,则必须等待一段时间才能传播更改。多久?根据我的经验,这是4-10个小时。这可能取决于您的位置。

请注意,Google Play服务会在您的设备上缓存请求。这可能也是问题,但设备重启应该有所帮助。您也可以尝试使用此命令清除Play服务缓存:

adb shell pm clear com.android.vending