2014-08-13 23 views
5

Şu anda uygulamanızda uygulama satın alımlarımda başladığım zaman, IabHelper.QueryInventoryFinishedListener yöntemine ulaştığımda her zaman hata kodu -1003 sorgulama sahiplerine ait öğeler imza imzası doğrulaması başarısız oldu.Uygulama İçi Faturalandırma Uygulaması

Şu anda

anahtar bana doğru görünüyor hakkında "Önemsiz Drive" örneği versiyonunu ben android.app.purchassed kullandığımda çok satın almak çünkü, sanırım benim imza ... doğrudur kullanır çünkü yayıncının kendi içinde normal olan ürünü satın alamayacağını söyleyen bir ürünü satın aldığımda tıklıyorum (eğer bir şey koyarsam, ürün yok diyen başka bir hatam var). Eksileri için test ürününü "android.test.purchasse" koyduğumda aynı hatayı aldım, o zaman test etmem gerekiyor.

Orada android.test.purchasse ile bir satın alma yaptım ve zaten başarabiliyorsanız başarılı olamadım.

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    // load game data 
    loadData(); 

    String base64EncodedPublicKey = "MY_KEY_BASE64"; 

    PublicKey key = Security.generatePublicKey(base64EncodedPublicKey); 
    // Create the helper, passing it our context and the public key to verify signatures with 
    Log.d(TAG, "Creating IAB helper."); 
    mHelper = new IabHelper(this, base64EncodedPublicKey); 

    // enable debug logging (for a production application, you should set this to false). 
    mHelper.enableDebugLogging(true); 

    // Start setup. This is asynchronous and the specified listener 
    // will be called once setup completes. 
    Log.d(TAG, "Starting setup."); 
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { 
     public void onIabSetupFinished(IabResult result) { 
      Log.d(TAG, "Setup finished."); 

      if (!result.isSuccess()) { 
       // Oh noes, there was a problem. 
       complain("Problem setting up in-app billing: " + result); 
       return; 
      } 

      // Have we been disposed of in the meantime? If so, quit. 
      if (mHelper == null) return; 

      // IAB is fully set up. Now, let's get an inventory of stuff we own. 
      Log.d(TAG, "Setup successful. Querying inventory."); 
      mHelper.queryInventoryAsync(mGotInventoryListener); 
     } 
    }); 
} 


// Listener that's called when we finish querying the items and subscriptions we own 
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() { 
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) { 
     Log.d(TAG, "Query inventory finished."); 

     // Have we been disposed of in the meantime? If so, quit. 
     if (mHelper == null) return; 

     // Is it a failure? 
     if (result.isFailure()) { 
      complain("Failed to query inventory: " + result); 
      return; 
     } 

     Log.d(TAG, "Query inventory was successful."); 

     /* 
     * Check for items we own. Notice that for each purchase, we check 
     * the developer payload to see if it's correct! See 
     * verifyDeveloperPayload(). 
     */ 
     if(inventory.hasPurchase(SKU_GAS)) 
     { 
      Toast.makeText(getApplicationContext(),"PREMIUM",Toast.LENGTH_SHORT).show(); 
     }else{ 
      Toast.makeText(getApplicationContext(),"NOT PREMIUM", Toast.LENGTH_SHORT).show(); 
     } 


     // Do we have the premium upgrade? 
     Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM); 
     mIsPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase)); 
     Log.d(TAG, "User is " + (mIsPremium ? "PREMIUM" : "NOT PREMIUM")); 

     // Do we have the infinite gas plan? 
     Purchase infiniteGasPurchase = inventory.getPurchase(SKU_INFINITE_GAS); 
     mSubscribedToInfiniteGas = (infiniteGasPurchase != null && verifyDeveloperPayload(infiniteGasPurchase)); 
     Log.d(TAG, "User " + (mSubscribedToInfiniteGas ? "HAS" : "DOES NOT HAVE") 
        + " infinite gas subscription."); 
     if (mSubscribedToInfiniteGas) mTank = TANK_MAX; 

     // Check for gas delivery -- if we own gas, we should fill up the tank immediately 
     Purchase gasPurchase = inventory.getPurchase(SKU_GAS); 
     if (gasPurchase != null && verifyDeveloperPayload(gasPurchase)) { 
      Log.d(TAG, "We have gas. Consuming it."); 
      mHelper.consumeAsync(inventory.getPurchase(SKU_GAS), mConsumeFinishedListener); 
      return; 
     } 

     updateUi(); 
     setWaitScreen(false); 
     Log.d(TAG, "Initial inventory query finished; enabling main UI."); 
    } 
}; 

Hiç endişelendiniz mi? Bu böcek yardımı için hiçbir çıkış göremiyorum, takdir edilecektir.

Eğer

cevap

2

Sen bir test hesabı oluşturun ve playstore yöneticisi sayfasında koymak gerekir teşekkür ederim.

İlgili konular