Domanda

Sto cercando di testare la fatturazione in-app nella mia applicazione Android. Il problema è che sembra che il mio mercato non sia aggiornato poiché non riesco a legare al servizio di fatturazione (sto usando il codice di esempio Android da qui. Continuo a ricevere il messaggio Questa app non può connettersi al mercato. La tua versione del mercato potrebbe essere obsoleta. Puoi continuare a utilizzare questa app ma non sarai in grado di effettuare acquisti.

Ho provato ad aggiornare il mercato aprendolo, colpendo la casa e aspettando 5-10 minuti e riprovando come indicato qui, ma non ha risolto il problema. Sto testando su un nexus senza connessione al telefono - appena sopra WiFi (non sono sicuro se questo è pertinente) con OS 2.2. Qualcun altro ha incontrato questo problema?

Ecco il codice della mia attività:

if (!mBillingService.checkBillingSupported()) {
    showDialog(DIALOG_CANNOT_CONNECT_ID);
}

E questo è il codice del mio servizio di fatturazione che mostra che la fatturazione non è supportata:

public boolean checkBillingSupported() {
    return new CheckBillingSupported().runRequest();
}

    class CheckBillingSupported extends BillingRequest {
    public CheckBillingSupported() {
        // This object is never created as a side effect of starting this
        // service so we pass -1 as the startId to indicate that we should
        // not stop this service after executing this request.
        super(-1);
    }

    @Override
    protected long run() throws RemoteException {
        Bundle request = makeRequestBundle("CHECK_BILLING_SUPPORTED");
        Bundle response = mService.sendBillingRequest(request);
        int responseCode = response.getInt(Consts.BILLING_RESPONSE_RESPONSE_CODE);
        if (Consts.DEBUG) {
            Log.i(TAG, "CheckBillingSupported response code: " +
                    ResponseCode.valueOf(responseCode));
        }
        boolean billingSupported = (responseCode == ResponseCode.RESULT_OK.ordinal());
        ResponseHandler.checkBillingSupportedResponse(billingSupported);
        return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
    }
}


    private boolean bindToMarketBillingService() {
    try {
        if (Consts.DEBUG) {
            Log.i(TAG, "binding to Market billing service");
        }
        boolean bindResult = bindService(
                new Intent(Consts.MARKET_BILLING_SERVICE_ACTION),
                this,  // ServiceConnection.
                Context.BIND_AUTO_CREATE);

        if (bindResult) {
            return true;
        } else {
            Log.e(TAG, "Could not bind to service.");
        }
    } catch (SecurityException e) {
        Log.e(TAG, "Security exception: " + e);
    }
    return false;
}
È stato utile?

Soluzione

Forse richiede che il telefono abbia una connessione dati mobile. Puoi provare a installare l'ultimo app di mercato manualmente.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top