AB Testing: how can I handle failed getVariations method call ?
I have a AB Test that tests if a certain ad unit is better then the other one. To do this, I need to get the variables before loading the ads. However, the getVariations method returns immediately, so I can't start loading the ads after that call. The callback method is available, but it only implements a onComplete() method, so when the AB Test retrieval data fails, there is no code path to implement to start loading the ads with some default value anyway. It's a really weird design of the API. How do you expect people to handle failed Variations retrieval? And how can I set a timeout for the getVariations method? Like: I want to wait max 2 seconds before cancelling the request and going with my standard hardcoded settings. Am I missing something??
Hello Peter, Thank you for writing to us. abClient.getVariations() is an asynchronous call and you can only expect the result through callback. I think there is no failure case that is thought for getVariations(). So in every case you will receive a callback in onComplete(). If you find there your variation value, you should take action accordingly. Are you seeing in real time that you are waiting for the callback but did not receive any after long time also? This should not happen. Please let us know if it happens. So that I can send this case to API team. You can set your own Timer in the app that will be started while calling getVariation() and wait for desired seconds, then wake up and check whether whether variation is loaded or not.