Bonjour,
Je travaille actuellement sur l'achat in app dans mon application, lorsque celle-ci se lance j'ai toujours le code d'erreur querying owned items response -1003 signature verification failed lorsque j'arrive dans la méthode IabHelper.QueryInventoryFinishedListener.
J'utilise pour le moment la version exemple de Google "Trivial Drive", je suppose que ma signature est correcte car j'arrive bien à acheter lorsque j'utilise android.app.purchassed...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // load game data loadData(); String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkpZ8ZixFTfPIkSVE4tWWJGek0C2NM5c/3dAI3w4KM4jSUjoPDGYpEsuoysQcoKFdkdkTG2X4iEkwxgRfPARMgBJyDSoDsHQk/b8rvPfEeP4yPNvP6r4J90ZXJaQfebqkQHsgyKHYXrPzzeor6sxnWmXPF7HqD10aGqu9l6bFQORK/lnMCZu4uZjfucb71qwsvNnQDHTS5+2sfvMwO1omrl83Z9oJCz90g564VAVEOZCS4rR4mQMf0RXpITgcstAlYzuj+XmLlOhqhyJKSJmqnpRoLgYbh2W4plG6yhH+3uw20VfVZkfih838NrM0mPSiwuIpcbKDxA5+0cnBPo8/vQIDAQAB"; 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); } }); }Avez-vous déjà eu le souci ? Je vois pas d'issue pour ce bug une aide de votre part sera appréciable. Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 // 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."); } };
Cordialement,
Partager