Giter VIP home page Giter VIP logo

Comments (8)

pozirk avatar pozirk commented on August 11, 2024

So, you have subscriptions as well? As I have never tested them.

IABHelper.java is a file written by Google employee, and I believe it has many bugs.

from androidinapppurchase.

bricecarpentier avatar bricecarpentier commented on August 11, 2024

You can deem this issue as invalid or whatever. What actually happened was that I had two restore entering a race condition and invalidating each other. Sorry I bothered you.

(and I don't use subscriptions either, at least not at the moment)

from androidinapppurchase.

pozirk avatar pozirk commented on August 11, 2024

I have checked a code like: instance.restore([MY_ITEM_ID]); and it works fine for me, but I don't have any subscriptions.
Also, this line of code doesn't restore any subscriptions and have to work without problems anyway.
You should be more clear, if you want me to fix the problem

from androidinapppurchase.

bricecarpentier avatar bricecarpentier commented on August 11, 2024

The issue was actually somewhere else in my code. I had something like:

public class FirstCommand
{
    // injected somehow
    public var instance:InAppPurchase;

    public function execute():void 
    {
        instance.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
        instance.restore([MY_ITEM_ID]); // needless to say I've checked that the ID indeed exists
    }

    private function onRestoreSuccess(event:InAppPurchaseEvent):void
    {
        var detail:InAppSkuDetails = instance.getSkuDetails(MY_ITEM_ID);
        // detail is null
    }
}

public class SecondCommand
{
    public var instance:InAppPurchase;

    public function execute():void
    {
        instance.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
        instance.restore();
    }

    private function onRestoreSuccess(event:InAppPurchaseEvent):void
    {
        // do something
    }
}

As you can now guess, SecondCommand's restore call took less time than FirstCommand's one...

from androidinapppurchase.

pozirk avatar pozirk commented on August 11, 2024

It took less time, so?

from androidinapppurchase.

bricecarpentier avatar bricecarpentier commented on August 11, 2024

So, since MY_ITEM_ID is a currently not owned sku, restore([MY_ITEM_ID]) fills the Inventory with MY_ITEM_ID's details, but restore() (without specifying moreItemsSkus) creates a new Inventory where MY_ITEM_ID's details are not available.

Like I said, the mistake was actually on my side.

from androidinapppurchase.

pozirk avatar pozirk commented on August 11, 2024

yeah...

from androidinapppurchase.

joefaron avatar joefaron commented on August 11, 2024

lol

from androidinapppurchase.

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.