We implemented In-app Billing one year ago with no problems following the sample code from the documentation. Some weeks ago we noticed users complaints about not getting their items. While debugging the code we found that the following sentence was the root of the problem:

/**
 * Called when this activity is no longer visible.
 */
@Override
protected void onStop() {
    super.onStop();
    ResponseHandler.unregister(mDungeonsPurchaseObserver);
}

On my Samsung Galaxy S device this method is being called when the Market screen appears, clearing the observer and interrupting the overall circuit. We've moved the call to the OnDestroy method instead and it's working ok now.

Is this the correct way to handle the problem? Has anyone experienced this?

有帮助吗?

解决方案

I was facing the same problem. I've implemented a queue on ResponseHandler: if the observer is null, I put the information on the queue; as soon an observer is added, I call it using the information from the queue. It makes sense in my application and it seems to be working fine.

I do not know if putting in onDestroy is a good idea, because it makes no sense to update the interface of an Activity that is not visible.

Are you experiencing any problem with your solution?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top