Mehdi TmimiMobile DevelopmentMobile

Mobile Development Chapter 01 · The four families

Who draws the pixels of a mobile app?

Two apps show the same screen. One is a web page. The other is made of real Android views. What tells them apart is a question: who draws the pixels?

The short answerEvery app does two jobs: it draws pixels, and asks the OS for help. Three painters draw: the platform's toolkit, an engine the app brings, a browser engine. Native code asks, a plugin or your own; a PWA has only the browser.

The film

The film's title card: Who draws the pixels of a mobile app?

Film coming soon

Short film · 6:53 · English narration · captionsEverything in the film is on this page. Watch on YouTube
Go deeper The film's words, and their real names 1 min
In the filmIts real name
the system's workshop, its shelves of ready-made partsthe platform's toolkit: its views and widgets
the translatorReact Native: it turns your components into native views, and asks the OS through native modules
Flutter's painterFlutter's engine, which paints with its renderer, Impeller
the canvas the system lendsone Android view, a surface: FlutterSurfaceView
game engines like Unityengines that paint a whole game on one surface: on Android, a SurfaceView
a part from the shelf: a WebViewa native view the system provides, with a browser engine inside: Android's WebView, iOS's WKWebView
a web page, inside a native appa hybrid app: its native shell (Capacitor, Cordova) holds the page in a WebView, with its plugins
a web app, a progressive web appa PWA: a website with a manifest and a service worker, which the browser installs, draws, and asks the OS for
pluginsnative code that asks the OS: Flutter's plugins, Capacitor's or Cordova's, and React Native's native modules
a plugin, or your own, written for each phonenative code that asks the OS: a ready-made plugin or native module, or one you write, once for Android and once for iOS
three paintersthe three kinds of painter: the platform's toolkit, an engine the app brings, a browser engine

Four families, three kinds of painter

Pick a family. Watch which layer draws, and who asks the OS.

  • Native. Your Kotlin or Swift asks the OS directly. The platform's own toolkit draws: Views or Jetpack Compose on Android, SwiftUI or UIKit on iOS. Bounds: a forest of boxes.
  • React Native, with Expo. Your JavaScript runs in Hermes, with no HTML and no browser. It asks the OS for real native widgets, and the OS draws them. Native modules ask the OS for the rest. Bounds: a forest of boxes.
  • Flutter. Your Dart code. Flutter's own engine paints every pixel, on one surface the OS lends it, as a game engine does. Plugins ask the OS. Bounds: one box.
  • Hybrid: Ionic, Capacitor. A native app from the store, whose screen is a WebView: its browser engine draws your web app. The app's plugins ask the OS. Bounds: one box, the WebView.
  • PWA. A website with a manifest and a service worker, installed from the browser, with no native app of its own. The browser draws it, asks the OS, and decides what the page may use. Bounds: Chrome's, not the app's.

Cross-platform is one family with two ways. React Native lets the OS draw. Flutter brings its own painter.

Go deeper What the explorer leaves out 1 min

Jetpack Compose is Google's toolkit for Android screens. It ships inside your app, not with the system. Its parts live inside one Android view, and Android's own graphics library draws them: that is why it counts as the platform's toolkit. Flutter brings its own engine.

With layout bounds on, Compose outlines its own parts too, so boxes cannot tell it from classic views. The view tree can, with AndroidComposeView.

Flutter keeps its own widgets on every phone. By default, it imitates each platform's fonts and scrolling.

Kotlin Multiplatform and .NET MAUI are cross-platform too. This course does not use them.

Words differ. Capacitor calls itself "a cross-platform native runtime". In this course, cross-platform means an app drawn without a browser; a hybrid app is a family of its own, because a browser engine draws it.

The second way: its own painter

Flutter is the other cross-platform way. The app brings its own engine, and the system only lends it one surface. The engine paints every pixel on it, with parts of its own, not the platform's.

For the phone's features, Flutter calls plugins: small pieces of native code, in Kotlin and in Swift, ready-made or your own. Game engines such as Unity paint the same way.

Illustration, bounds on: one surface each, so one box each. Inside, Flutter's engine or Unity's paints every pixel.

Same approach, two main uses: Flutter mostly builds app screens, Unity mostly games.

Go deeper Flutter, Unity, and other painters 1 min

Flutter is a UI toolkit, in Dart. Its engine ships inside your app and paints into one Android view, by default a FlutterSurfaceView. Flutter can also host a native view, such as a map, inside that surface: a platform view. Its renderer is Impeller on Android 10 and later with Vulkan; other phones get the legacy OpenGL renderer. Most plugins reach the OS through platform channels; some call native code directly, with dart:ffi.

Unity is a game engine, in C#. On Android, GameActivity, its default entry point for new projects, renders into a SurfaceView. Unity's own APIs cover common features; its plug-ins call Java, Kotlin or C++ code for the rest.

Godot, another game engine, paints with its own renderers too. And on iOS, Compose Multiplatform draws a Kotlin app's screens on a canvas, with Skia: its own painter, like Flutter.

Hybrid is not cross-platform

Both promise one codebase for two platforms. The difference is who draws. A hybrid app's screen is one WebView, whose browser engine draws a web page. A cross-platform app has no browser.

Guess first: how many boxes in each? Then turn the bounds on.

The Flutter demo app. With Show layout bounds on: one box around the whole screen, nothing outlined inside.
Flutterone box
The Expo demo app, in JavaScript. With Show layout bounds on: a box around the header, each row, each text, the chevrons and the button.
React Nativea box per part
The hybrid demo app, a web page in a WebView. With Show layout bounds on: one box around the page, nothing outlined inside.
Hybridone box
Same screen, three demo apps, bounds on. React Native: a box per part. Flutter and the WebView: one box each, which we marked in red. Boxes cannot tell those two apart; the view tree can. Real captures, Android 16 emulator, October 2026. Status bars blurred.

React Native is not a web view: the OS draws its parts. Nor is Flutter: its own engine paints.

Go deeper Why a hybrid app can change without an update 1 min

On Android, the WebView is not part of your app. It is a system component: Android System WebView on Android 10 and later, Chrome itself on Android 7 to 9. Google updates it through the Play Store, on phones with Google services. On iOS, WKWebView ships with the OS.

So a hybrid app’s rendering can change on a phone where nothing of the app was updated. A Flutter or Jetpack Compose app’s widgets cannot: their code ships inside the app, like the AndroidX and Material widgets of a Views app. A UIKit, SwiftUI or React Native app’s widgets, and Android’s own android.widget views, change only when the OS does.

Checkpoint

Show layout bounds is on. An app shows one box the size of the screen, and nothing inside it. What can you conclude?

See the answer

One box says that one view holds the whole screen, and something paints inside it: a browser engine, Flutter's engine, or a game engine such as Unity's. Boxes are evidence; the view tree is the proof, step 4 of Try it.

A hybrid app is not a PWA

Both show a web page, painted by a browser engine. What differs is what holds it.

The page

From the store Hybrid

The page

drawsA WebView A native view the system provides. Its browser engine paints the page.bridge

asksThe native shell Its plugins, ready-made or yours: native code the page calls.pluginyour ownKotlin + Swift

The OS

  • Camera: through a plugin.
  • Anything else: your own native code, written for each phone.

From the browser PWA

The page

drawsasksThe browser It paints the page, and asks the OS for it.decides

No native shell

The OS

  • Camera: the browser allows it.
  • A feature it does not expose: impossible.

The OS

So a hybrid app can reach everything, through native code, not its WebView alone. A PWA gets only what the browser allows.

Go deeper The bridge, and a PWA on Google Play 1 min

On Android, an app can let the JavaScript of its WebView call its own Kotlin or Java code: Android recommends addWebMessageListener, and the older addJavascriptInterface only for very old versions. That is a bridge, and Capacitor uses the first when the WebView supports it. Each Capacitor plugin is registered on both sides: the page calls a JavaScript object, and the plugin's native code runs.

A plugin is part of your app: it runs with your app's permissions. Cordova works the same way: its plugins let the page invoke native code. A page in a WebView can also use some web APIs, such as the camera or a file picker, but only as far as the app allows: on Android, its native code must grant each request; on iOS, the app must declare the camera's purpose string, and can refuse. The shell still decides.

A PWA can also reach Google Play, wrapped in a thin Android app, a Trusted Web Activity. The page still runs in a browser tab, full screen, with no browser bars. That wrapper is not a hybrid app's shell: the page runs in Chrome, not in a WebView with plugins, and Chrome decides what it may use. And when you install a PWA from Chrome on Android, Chrome generates a small package for it, a WebAPK: the site still runs in Chrome.

Checkpoint

Your Ionic app needs a phone sensor that no ready-made plugin covers. What do you do?

See the answer

A hybrid app can reach everything through native code. When no plugin exists, you write your own, once for Android and once for iOS, and the page calls it through the bridge. That is a cost, not a limit; only a PWA is limited to what the browser allows.

Two answers decide the rest

The arguments you will hear are not opinions: most follow from the two answers below.

 NativeCross-platformHybridPWA
Who drawsThe platform's toolkit.React Native: the OS, with native views. Flutter: its own engine.The browser engine of its WebView.The browser's engine.
Who asks the OSYour code, directly.React Native: native modules. Flutter: plugins. Ready-made, or your own.Its plugins, ready-made or your own.The browser, which decides what the page may use.
LookThe platform's own.React Native: the platform's widgets. Flutter: its own.A web page, unless styled to the platform.A web page, without browser bars.
Performance ceilingThe highest: nothing in between.Close to native for most apps.A browser engine's: long lists show it.The same browser engine's limits.
Device accessEverything, the day the OS ships it.Everything too, once native code exists for it: a module or plugin, or your own, written for each platform.Everything too, once a plugin exists for it: ready-made, or your own, written for each platform.Only what the browser exposes; less on an iPhone.
UpdatesA new build, through the stores.The stores; JavaScript can also update over the air.The stores; the web layer can update live.The next visit. No store.

Four consequences, two causes. When someone says one family is better, ask which row they mean.

Go deeper Updates that skip the store 1 min

Over the air. A React Native app can replace its JavaScript and images without a new store build: EAS Update does it for Expo. A hybrid app can do the same with its web layer. Both must stay within the stores' rules.

A PWA fetches its new version on the next visit. The new service worker waits, and takes over once the app's windows are closed.

With knowledge · in class

Name the family before the AI does

Ask an assistant for "a mobile app" and it chooses a family for you, often Expo. It rarely asks you. The family is your first decision: name it, then check it.

Paste first, whatever the family

Before writing any file, state the family you chose, who will draw the pixels, and what will ask the OS for each phone feature.

All families

Say it in the prompt

Put your family's phrase in your first prompt, after what the app does.

  • Native Android: a native Android app in Kotlin with Jetpack Compose, as an Android Studio project
  • Cross-platform: an Expo (React Native) app in TypeScript
  • Cross-platform, Flutter: a Flutter app in Dart, for Android and iOS
  • Hybrid: an Ionic app with Capacitor and Angular, for Android and iOS
  • PWA: an installable progressive web app with React and Vite: a web manifest and a service worker that works offline

Which family is this project?

  1. Is there a package.json at the root? No: native, with Java, Kotlin or Swift files, or Flutter if there is a pubspec.yaml. Kotlin Multiplatform, .NET MAUI and Unity have none either; this course does not use them.
  2. Is there a capacitor.config.ts or .json, or a Cordova config.xml? Yes: hybrid.
  3. Does package.json list react-native? Yes: cross-platform. No, with a web manifest and a service worker: PWA. Look for them as files, or as a plugin such as vite-plugin-pwa in vite.config, which generates both at build time.

Native

Say it in the prompt

a native Android app in Kotlin with Jetpack Compose, as an Android Studio project

Put this phrase in your first prompt, after what the app does.

Then check the project

Expo

Say it in the prompt

an Expo (React Native) app in TypeScript

Put this phrase in your first prompt, after what the app does.

Then check the project

Flutter

Say it in the prompt

a Flutter app in Dart, for Android and iOS

Put this phrase in your first prompt, after what the app does.

Then check the project

Ionic

Say it in the prompt

an Ionic app with Capacitor and Angular, for Android and iOS

Put this phrase in your first prompt, after what the app does.

Then check the project

PWA

Say it in the prompt

an installable progressive web app with React and Vite: a web manifest and a service worker that works offline

Put this phrase in your first prompt, after what the app does.

Then check the project

If the project contradicts your prompt, the assistant changed your decision: say so, and ask again.

Try it on your phone · 10 minutes

See who draws, on your own phone

Before class Turn on Developer options 1 min

Settings → About phone → tap Build number seven times. On a Samsung, it sits under Software information; on a Xiaomi, tap the HyperOS or MIUI version instead. Developer options then appear in Settings, often under System or Additional settings.

For step 4, also turn on USB debugging and install adb, as in the Try it of What happens when you tap an app's icon?

  1. Turn it on. Developer options → Drawing → Show layout bounds.

    Developer options, the Drawing section: Show layout bounds is switched on, and every row, label and switch now has a box.

    This shows Outlines appear in every app, Settings included.

  2. Open Settings, its home screen.

    The Android Settings app with Show layout bounds on: a box around every row, icon and label.

    This shows A box around every row, icon and label. The platform's own toolkit draws this screen, part by part.

  3. Open five apps you use, a game among them, and sort them.

    • A forest of boxes: Android views, Jetpack Compose or React Native.
    • One box the size of the screen: another painter, such as Flutter, a game engine or a WebView.
    • A PWA you installed: Chrome draws it, so any boxes are Chrome's.

    This shows A first sort. Boxes are evidence, not yet a proof.

  4. With a cable, read the view tree. The command prints the top activity of every task: read the part under your app's ACTIVITY line. Search it for WebView, FlutterView, AndroidComposeView or ReactSurfaceView.

    adb shell dumpsys activity top
    You should see, for the hybrid demoACTIVITY com.tmimiexplains.webviewdemo/.MainActivity …
      View Hierarchy:
        com.android.internal.policy.DecorView{… 0,0-1080,2400}[MainActivity]
          android.widget.LinearLayout{… 0,0-1080,2337}
            android.widget.FrameLayout{… 0,136-1080,2337 android:id/content}
              android.webkit.WebView{… 0,0-1080,2201}

    This proves One view, a WebView. The browser engine draws everything inside it.

    A release build, such as a store app, may show short renamed classes instead, as the Flutter demo does in the fold below.

Go deeper Other trees, and Android Studio 3 min

Jetpack Compose draws its own outlines too: Settings → All apps shows boxes everywhere, and its tree ends in one AndroidComposeView. Boxes are evidence; the tree is the proof.

Settings, All apps, with Show layout bounds on: a box around every row, icon and label.
Settings → All apps, bounds on: boxes everywhere.
Its view tree, real output, trimmedACTIVITY com.android.settings/.spa.SpaActivity …
  View Hierarchy:
    com.android.internal.policy.DecorView{… 0,0-1080,2400}[SpaActivity]
      android.widget.LinearLayout{… 0,0-1080,2400}
        android.widget.FrameLayout{… 0,0-1080,2400 android:id/content}
          androidx.compose.ui.platform.ComposeView{… 0,0-1080,2400}
            androidx.compose.ui.platform.AndroidComposeView{… 0,0-1080,2400 …}

The Expo demo shows a ReactSurfaceView, then 7 ReactViewGroup and 10 ReactTextView: real Android views. Apps still on React Native's old architecture show ReactRootView.

The Expo demo, real output, trimmedcom.facebook.react.runtime.ReactSurfaceView{… 0,0-1080,2400 #1}
  com.facebook.react.views.view.ReactViewGroup{… 0,0-1080,2400 #36}
  com.facebook.react.views.view.ReactViewGroup{… 0,0-1080,420 #a}
  com.facebook.react.views.text.ReactTextView{… 57,183-1023,289 #4}
  com.facebook.react.views.text.ReactTextView{… 57,305-1023,362 #8}
  …

The Flutter demo, a release build, shows one view the size of the screen with one child. R8 renamed both classes to y7 and p7. The build's mapping.txt translates them: FlutterView and FlutterSurfaceView.

The Flutter demo, real output, trimmedandroid.widget.FrameLayout{… 0,0-1080,2400 android:id/content}
  y7{… 0,0-1080,2400 #1}
    p7{… 0,0-1080,2400}

If the command hangs, a frozen app in the background can be the cause. Name your app's activity instead: adb shell dumpsys activity your.package.name/.MainActivity, with your app's package name.

Android Studio's Layout Inspector shows the same tree as a picture, but only for a debuggable app: the debug builds you run from Android Studio, such as your native and Capacitor labs. Not Expo Go, which is a store app, and not a PWA, which runs inside Chrome.

Quick check

By the rule of this course, an assistant types most of your lab app's code. What stays yours?

See the answer

Every decision is yours, starting with the family you name in your first prompt, and every behaviour is tested by you. You test behaviours, not lines, and the language never decides the family: the drawing layer does.

An app is written in JavaScript, and its screen is made of the platform's own views, drawn by the OS. Which family?

See the answer

The drawing layer decides the family, not the language: JavaScript that ends in real native widgets is React Native, cross-platform. A hybrid app would show one WebView, and JavaScript does not mean a web page.

Hybrid and cross-platform apps both promise one codebase for two platforms. What tells them apart?

See the answer

In a hybrid app a browser engine draws, so the app is a web page; a cross-platform app has no browser. React Native is JavaScript too, and hybrid apps ship through the stores as well.

Show layout bounds is on. Two cross-platform apps show the same screen. App A shows one box; app B, a box around every button. Which is which?

See the answer

Flutter paints its whole interface on one surface, so Android outlines one box; React Native asks the OS for real widgets, so each button gets its own. Same family, two hands on the pixels.

Show layout bounds is on. An app shows a box around every row, icon and label. What can you conclude?

See the answer

Classic views, Jetpack Compose and React Native all outline each part, so the boxes narrow it down and the view tree, from dumpsys, decides. Compose draws its own outlines, which is why boxes alone cannot prove classic views.

Your Ionic app must take a photo with the phone's camera. What carries the request from the page to the OS?

See the answer

In a hybrid app, plugins ask the OS: Capacitor's Camera plugin is native code that the page calls from JavaScript. The WebView alone cannot open every door, and it runs with your app's permissions, not Chrome's.

Your Flutter app shows the phone's battery level. Who asks the OS for it?

See the answer

Drawing and asking are two jobs: Flutter's engine paints the screen, but it does not read the battery. Your Dart sends a message through a platform channel to native code that does: a ready-made plugin such as battery_plus, or your own code, as in Flutter's own guide.

Your app needs a phone feature that no ready-made plugin or module covers. Which family cannot get it, whatever code you write?

See the answer

A PWA has no native code of its own: the browser decides what it gets, and gives less on an iPhone. React Native, Flutter and hybrid apps can all run your own native code, written for Android and for iOS: a cost, not a limit.

Two apps show the same web page. One is a hybrid app from the store; the other is a PWA, installed from Chrome. Which one can run native code you wrote?

See the answer

A hybrid app is a native app: its plugins, ready-made or yours, run native code that the page calls through a bridge. A PWA has no such shell, even on Google Play as a Trusted Web Activity: Chrome runs it, and decides what it may use.

Overnight, the Play Store updated a phone's system components. Your app was not updated, yet one of its screens now looks different. Which app is it?

See the answer

On Android, the WebView is a system component, updated through the Play Store, so a hybrid app's rendering can change on its own. Flutter and Compose ship inside your app: their widgets change only with a new build.

You fix a bug in your PWA's JavaScript and deploy it to your server. How does the fix reach a user who installed the app?

See the answer

A PWA is a website: no store, and no build to review. The browser fetches the new service worker at the next visit, and it takes over once the app's old windows are closed.

You asked an assistant for an Ionic app with Capacitor. Its package.json lists expo and react-native, and there is no capacitor.config. What do you do?

See the answer

react-native in package.json means a cross-platform app, and a Capacitor project gets its capacitor.config at init, before any npx cap add. The assistant changed your decision: say so, and ask again.

Recap

  1. Two jobs. Every app draws pixels and asks the OS. Who does each defines the family.
  2. Who draws. Native apps and React Native: the platform's toolkit. Flutter and game engines: their own engine. Hybrid apps and PWAs: a browser engine.
  3. Who asks. Native code: a plugin, or your own, written for each platform. It reaches everything. Only a PWA depends on the browser.
  4. See it. Layout bounds give a first sort; dumpsys gives the proof.
  5. With an AI. Name the family first. Then check the project.

Sources