문제

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