Article · Architecture

One app, many native extensions – and they have to work together

The number of ANEs doesn't matter. What matters is that every single one does its job, and that they don't get in each other's way.


A real Adobe AIR app needs native extensions. Not one, many. Our own live video app, published on the App Store, Google Play, the Mac App Store and the Microsoft Store, uses more than a dozen of them: camera and voice, push, in-app purchases, Sign in with Apple and Google, native dialogs, the keychain, a device ID, phone or tablet detection, foldable layouts, the torch, QR pairing, the photo gallery, and system functions like network status and Face ID.

That is normal. A modern app touches a lot of the operating system, and AIR reaches it through extensions. The question isn't how many extensions you need. The question is whether they fit together.

A package manager matches versions, not behaviour

With distriqt extensions, the most common choice for AIR developers, you let APM, the AIR package manager, sort out the dependencies. It makes sure that shared libraries have compatible version numbers.

But version numbers are only part of the problem. Extensions also have to agree on behaviour, and no package manager checks that. These are conflicts we ran into ourselves in production apps:

  • Two extensions control the same screen state. In our Android app, two distriqt extensions, Application and Display, both managed Android's immersive mode, and each reset what the other had set. Result: the status bar flickered on every screen change on phones. APM had installed both in perfectly matching versions.
  • Two owners for the microphone. One extension runs a native audio session with echo cancellation. If anything else, even AIR's own microphone class, opens a second capture afterwards, the audio session breaks and can't be recovered at runtime.
  • App lifecycle events mean different things. AIR reports one and the same "deactivate" event for pressing the home button, opening Control Center and pulling down the notification shade. An extension that logs the user out on "deactivate" also logs them out when they only toggle airplane mode.
  • Updates in lockstep. A new version of one extension requires a new shared core, which requires new versions of three other extensions you didn't want to touch, and every combination has to be tested again.

Each extension works on its own. Together they don't. APM reports that everything is consistent, because the version numbers are. Nobody is responsible for the combination. Except you.

Every extension has to do its job completely

The count is irrelevant. Thirteen extensions that each do exactly one thing well, without side effects on the others, are better than five that overlap. What counts for every single one:

  1. It solves the whole problem, not half of it. A push extension that delivers a notification but can't open the right screen after a cold start isn't finished.
  2. It doesn't touch what isn't its job. No hidden analytics, no global settings, no second audio session, no extra helper libraries.
  3. It follows the platform's rules today: the current iOS, Android and macOS versions, store requirements, privacy rules.
  4. It's been proven in a real app, not only in a sample project.

This is where catalogue extensions fall short. distriqt delivers each extension with documentation and code examples: a small sample project per extension. Whether ten of them work together in a real, published app, through store reviews, OS updates and old devices, is left for you to find out. Code examples prove that one call works. They don't prove that an app works.

Klug: one family, built and tested together

We build our extensions for our own apps first. We don't ship code examples and hope; we ship what runs in our own published apps. That's why they are designed as one family: they share no libraries, but they share rules. One owner per resource, no hidden side effects, the same release cycle. Every release is tested with all of them together on real devices before it reaches you.

And testing doesn't stop at the release. We observe our extensions in live operation: our apps run on our own streaming servers, and their server logs, connection statistics and the crash and error reports from the App Store and Google Play are evaluated every day. When a new iOS or Android version, a new device or a weak network shows a problem, we see it in our own numbers, usually before any developer using our extensions does. That is the difference between code examples and production experience.

Extension What it does Platforms
KlugMedia Camera, H.264 video, two-way Opus voice with echo cancellation, over standard RTMP iOS · Android · macOS · Windows
KlugPush Push notifications; a tap opens the right screen, even from a cold start iOS · Android · macOS
KlugBilling In-app purchases and subscriptions, one API for the App Store and Google Play iOS · Android (macOS with our next release)
KlugAuth Sign in with Apple and Google with the system sheets iOS · Android · macOS
KlugDialog Native alerts, input dialogs above the keyboard, progress dialogs iOS · Android · macOS
KlugKeychain Secure storage that survives reinstalling the app iOS · macOS
KlugDeviceId A stable device identifier, also after a reinstall iOS · Android
KlugDeviceType Reliable phone or tablet detection from the system iOS · Android
KlugLayout Landscape on both sides for Android tablets, fold and cover-screen detection iOS · Android
KlugRegister QR codes and a native scanner, e.g. to pair a second device iOS · Android · macOS
KlugTorch Camera light while the camera is streaming iOS · Android
KlugGallery Save photos and videos to the gallery with minimal permissions iOS · Android
KlugSystem In-app browser, network status with change events, Face ID / fingerprint iOS · Android

Each one is a single self-contained file. No core library, no helper ANEs, no package manager. You use exactly the ones you need, and they keep working together when the next iOS, Android, macOS or Windows update arrives, because our own apps depend on the same combination. KlugMedia even brings the same camera, video and two-way voice to Windows 10 and 11, tested in our own Windows app.

All Klug native extensions for Adobe AIR: klughomesolutions.com

More articles