Code Monkey home page Code Monkey logo

Comments (14)

and7ey avatar and7ey commented on September 13, 2024

Btw, I also have the following code now:

@Override
public byte[] getObfuscationSalt() {
    return null;
}

@Override
public String getPublicKey() {
    return "here is my key copied from market publish page";
}

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

Btw, I also see the following record at LogCat:

07-08 13:54:03.636: DEBUG/BillingController(29306): Request 5419304117851015224 received response RESULT_OK

But

PurchaseManager.isPurchased(getApplicationContext(), ANDROID_MARKET_ITEM)

returns false.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

By debugging the code I've observed the following:

  1. onReceive#BillingReceiver calls responseCode(context, intent), not purchaseStateChanged(context, intent). Is that correct (http://developer.android.com/guide/market/billing/billing_overview.html#billing-action-notify)? Looks like it happens so, since I've already purchased this item before while testing another application.
    Probably, it will not work correctly with unmanaged items (http://developer.android.com/guide/market/billing/billing_admin.html#billing_purchase_type) also.
  2. onPurchaseStateChanged#BillingController receives empty signedData. Probably it happens so because data received for test items is not signed?

from androidbillinglibrary.

 avatar commented on September 13, 2024

Are you using BillingController.setDebug(true)?

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

Yes. See no other errors in the LogCat.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

If I use restoreTransactions, then onPurchaseStateChanged is never called, in result purchases are not saved in database.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

robotmedia, will you be able to help me with this?

from androidbillinglibrary.

 avatar commented on September 13, 2024

Re: question 1

After a purchase request BillingReceiver should receive both a RESPONSE_CODE and then an IN_APP_NOTIFY action. BillingReceiver will respectively call BillingController.onResponseCode and BillingController.onNotify.

The RESPONSE_CODE is simply to indicate if the request was successfully received by the Android Market server. From the Android documentation:

This response contains an Android Market server response code, and is sent after you make an in-app billing request. A server response code can indicate that a billing request was successfully sent to Android Market or it can indicate that some error occurred during a billing request. This response is not used to report any purchase state changes (such as refund or purchase information).

PURCHASE_STATE_CHANGED comes after the IN_APP_NOTIFY. This is the typical flow:

Billing request flow

The behavior here is the same if the item is managed or unmanaged.

Re: question 2

It seems from this that you're eventually received PURCHASE_STATE_CHANGED. If signedData is null, well, there's not much that our library can do. It can be null for many reasons. This might help: http://developer.android.com/guide/market/billing/billing_testing.html

Re: restoreTransactions question

Most likely the same thing that was giving you a null signedData before is at play here.

Hope this helps. Please let us know what was the issue when you solve it.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

Thanks for your reply.

Re: question 1
I've tested that with requestPurchase.

IN_APP_NOTIFY is not received.

Re: question 2
I've tested that with restoreTransactions. Will try to understand why data received is not signed.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

IN_APP_NOTIFY is not received.

Are you sure? Then how are you reaching BillingController.onPurchaseStateChanged afterwards? Bear in mind the BillingReceiver receives asynchronous messages.

onPurchaseStateChanged is reached with restoreTransactions, not with requestPurchase.

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

Hmm, looks like the problem is caused by usage of test account on the device, not developer's account (however, test account is added to the list of test accounts).

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

OK, when I've started to use developer's account on the device, it is started to work better.
Now I see that purchase of android.test.purchased is reflected in the database. But purchase status there is 0. Hence isPurchased returns false.

I've checked possible states

    public enum PurchaseState {
        // Responses to requestPurchase or restoreTransactions.
        PURCHASED,    // 0: The charge failed on the server.
        CANCELLED,   // 1: User was charged for the order.
        REFUNDED;    // 2: User received a refund for the order.

Is everything correct here?

from androidbillinglibrary.

and7ey avatar and7ey commented on September 13, 2024

And it is still work incorrectly with restoreTransactions. Looks like it can not be used with reserved items - http://stackoverflow.com/questions/6640480/why-restore-transactions-in-app-billing-returns-not-signed-data.

Btw, could you please provide me with example how public byte[] getObfuscationSalt() { can look like?

from androidbillinglibrary.

 avatar commented on September 13, 2024

Can you open separate issues for both the PurchaseState and salt questions?

If you do we will reply ASAP. Thanks.

from androidbillinglibrary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.