Separating ad SDK commands from events
Each time the ad changed, the previous SDK object was left behind. Commands no longer carry a result; what happens in the SDK is reported separately.
After we switched ads 30 times, 30 subscriptions and 150 listeners were left over, and the number of times the object had been released was 0. Releasing objects on time is obviously necessary. But that alone couldn't explain why the ad flow had become so complicated.
When the engine sent a command, it had to get back a differently shaped answer for each command, and a wrong answer could only be found by running it. If we typed each command so that it accepts only its own answer, we'd make this mistake rarer. But the engine would still have to know the order in which we check permission, start the ad and get consent. The wrong answer gets blocked, while the question of why the engine should know that order stays exactly where it was.
Separate requests from events
Asking for an ad to load is a request we make. An ad becoming ready or closing is an event that happens inside the SDK. The two don't have to come in pairs. So we took the answer out of commands, and made whatever happens in the SDK and the OS get reported separately. Commands went from six to three, and SDK objects are managed in just one place in the code.
We switched ads 30 times again. This time only 1 subscription and 5 listeners were left, and the object was released 29 times. These figures come from connecting a fake native module to the real SDK's JavaScript, though. We don't yet know whether they hold with real ads on a real device.
Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.
