Sto riscontrando un problema frustrante con il processo di fatturazione in-app. Ho creato una nuova applicazione nella console di sviluppo, ho aggiunto un prodotto inapp denominato "P1", che è attualmente attivo; Ho caricato la mia app nello store in versione alpha, poi promosso in versione beta, aggiunto un account tester e installato l'apk su un dispositivo (tablet) firmato con l'account tester e un altro con account dev.Fatturazione in-app per Android - queryInventoryAsync restituisce 0 risultato
Ora, mi piacerebbe interrogare il negozio per ottenere informazioni come il prezzo di skus non di proprietà. Ecco il mio codice dal mio attività:
private void istantiate() {
List<String> tmp = new List<String>();
tmp.add("P1");
final List<String> skus = tmp;
mHelper = new IabHelper(mContext, base64EncodedPublicKey);
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(true);
//create listener
bListener = new BillingListener(mHelper, mContext);
// Start setup. This is asynchronous and the specified listener will be called once setup completes.
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// There was a problem.
return;
}
getInventory(skus);
}
});
}
...
private void getInventory(List<String> skuList) {
// 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.
mHelper.queryInventoryAsync(true, skuList, bListener.mQueryFinishedListener);
}
Poi, quando query viene completata, questo pezzo di codice si chiama:
IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
// handle error
return;
}
...
}
};
Ma restituito l'inventario è vuoto. Ecco logcat:
12-13 11:21:36.977: D/IabHelper(6034): Billing service connected.
12-13 11:21:36.977: D/IabHelper(6034): Checking for in-app billing 3 support.
12-13 11:21:36.987: D/IabHelper(6034): In-app billing version 3 supported for ***
12-13 11:21:36.987: D/IabHelper(6034): Subscriptions AVAILABLE.
12-13 11:21:36.987: D/IabHelper(6034): Starting async operation: refresh inventory
12-13 11:21:36.987: D/IabHelper(6034): Querying owned items, item type: inapp
12-13 11:21:36.987: D/IabHelper(6034): Package name: ***
12-13 11:21:36.987: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Owned items response: 0
12-13 11:21:36.997: D/IabHelper(6034): Continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Querying owned items, item type: subs
12-13 11:21:37.097: D/IabHelper(6034): Package name: ***
12-13 11:21:37.097: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Owned items response: 0
12-13 11:21:37.097: D/IabHelper(6034): Continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Ending async operation: refresh inventory
Si tratta di una settimana da quando il mio prodotto inapp è stato pubblicato, quindi non è una questione di tempo. Ho provato a cancellare i dati dell'app e riavviare il dispositivo.
Modifica: Tutto funziona correttamente con android.test.purchased come test sku.
Edit 2: SKU sono "non gestito"
Sei riuscito a trovare una soluzione? Sto affrontando lo stesso identico problema. –
anche io sto vivendo questo ... qualche risultato? –
Attualmente sto ancora riscontrando il problema –