Implementing an Android TurboModule with Kotlin

youtube-cover
Teachers
Oskar Kwaśniewski
Software Developer
@
Callstack

TurboModules are designed to work consistently across platforms, but implementing them on Android involves a different set of tools, conventions, and generated code than on iOS. In this episode, Oskar Kwaśniewski walks through building an Android TurboModule from scratch, mirroring the Local Storage module introduced earlier in the series.

Starting from the shared TypeScript spec, Oskar shows how Codegen produces Android-specific interfaces, how to implement them in Kotlin, and how to register the module so React Native can load it under the New Architecture.

Revisiting the TypeScript spec

The episode begins with the same TypeScript TurboModule spec used in previous episodes. Oskar explains why the spec remains platform-agnostic and how it becomes the single source of truth for both iOS and Android implementations.

Running Codegen for Android

After updating the spec, Oskar runs Codegen to generate Android bindings. He walks through the generated files, focusing on the abstract base class and method signatures that must be implemented on the native side.

Implementing the TurboModule in Kotlin

Oskar creates a Kotlin class that extends the generated spec base and implements the required methods. Using the Local Storage example, he shows how to read and write values, return constants, and follow the threading expectations of TurboModules on Android.

Handling synchronous and asynchronous methods

The episode highlights the difference between sync and async methods on Android. Oskar explains how promise-based methods are represented in Kotlin, how results are resolved or rejected, and why long-running work should never block critical threads.

Registering the module with React Native

To make the TurboModule available to JavaScript, Oskar adds it to a custom TurboModule package. He explains how this package is wired into the app and how React Native discovers the module at runtime when the New Architecture is enabled.

Verifying the module from JavaScript

Finally, Oskar tests the Android TurboModule from JavaScript, calling its methods and confirming that data flows correctly between JS and native code—matching the behavior of the iOS implementation from earlier episodes.

Key takeaways

  • The TypeScript spec is shared across platforms.
  • Codegen produces platform-specific base classes for Android.
  • Android TurboModules are implemented in Kotlin and registered via a package.
  • Proper async handling is essential to avoid blocking threads.

Resources

TurboModules feel powerful but risky?

We help teams use them with confidence in real production apps.

Let’s chat
Link copied to clipboard!
//
Insights

Learn more about React Native

Stay up to date with our latest insights on React, React Native, and cross-platform development from the people who build the technology and scale with it daily.

//
insights

Learn more about React Native

//
React Native

We can help you move
it forward!

At Callstack, we work with companies big and small, pushing React Native everyday.

React Native Performance Optimization

Improve React Native apps speed and efficiency through targeted performance enhancements.

C++ Library Integration for React Native

Wrap existing C-compatible libraries for React Native with type-safe JavaScript APIs.

Shared Native Core for Cross-Platform Apps

Implement business logic once in C++ or Rust and run it across mobile, web, desktop, and TV.

Custom High-Performance Renderers

Build custom-rendered screens with WebGPU, Skia, or Filament for 60fps, 3D, and pixel-perfect UX.