How mobile apps work
A mobile app is a program installed on a phone, but it lives a very different life from a web page. Follow one chat app from the code it is written in, through the store's review, into its sandbox on the phone, out to its back end over an API, and back to life when a push notification arrives.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01A team wants one set of code that becomes both an iPhone app and an Android app. Which approach fits?
Flutter (Dart) and React Native (JavaScript) build iOS and Android apps from one code base. Swift and Kotlin are the native route: one program per system.
02What does the sandbox stop an app from doing?
Each app gets its own walled-off space and private folder. It can use its own files and the network, but not other apps' data or the system's.
03The chat app wants to show your messages. Where do they come from?
The screens are inside the app, but the data lives on the company's servers. The app sends GET /messages and draws the JSON it gets back.
04The app was suspended and then ended by the system to free memory. A new message arrives. What happens?
Push notifications go through Apple's or Google's push service over a connection the phone keeps open; the system shows them even when the app is not running.
05Why does every app carry a digital signature?
The signature is a seal only the signer can make. If one byte of the app changes, the check fails and the phone refuses it.
Glossary
- Native app
- An app written in a system's own language and tools: Swift for iOS, Kotlin for Android.
- Cross-platform
- One code base that builds apps for several systems, as Flutter (Dart) and React Native (JavaScript) do.
- Web app
- A website that behaves like an app and runs in the phone's browser; nothing goes through an app store.
- Sandbox
- The walled-off space the operating system gives each app, with its own private files and no access to other apps' data.
- Permission
- The user's yes or no, asked by the system, before an app may use the camera, location, contacts or other private things.
- API
- The set of requests a server agrees to answer, such as GET /messages, usually replying with JSON.
- App life cycle
- The states an app moves through: foreground (on screen), background, suspended (in memory, not running) and not running.
- Push notification
- A short message the server sends through Apple's or Google's push service, which the phone shows even if the app is not running.
Notes and sources
- The phone is drawn as an open tray so you can see inside. The sandbox walls, the permission door and the app block are pictures of rules the operating system enforces in software: on iOS each app gets its own container, on Android each app runs as its own Linux user.
- Older languages still work too: Objective-C on iOS and Java on Android. Swift and Kotlin are what Apple and Google recommend today, and there are other cross-platform tools, such as .NET MAUI and Kotlin Multiplatform.
- The App Store and Google Play are the main stores. Android also allows other stores and direct installs, and in the EU iPhones can use other app marketplaces; those apps are still signed and checked by the system.
- Apps usually keep a copy of recent data on the phone (a cache), so they open fast and work offline; the server keeps the main copy. The request travels over TCP or QUIC, encrypted with TLS, as the HTTPS lesson in the Networking course shows.
- iOS names the states active, inactive, background, suspended and not running. Android describes them with activity callbacks (onResume, onPause, onStop) and keeps background apps as cached processes, which Android 14 and later freeze until they are needed.
- Notifications only appear if the person allowed them: a permission on iOS, and on Android 13 and later. On Android, an app that the user force-stopped in Settings gets no messages until it is opened again.
- Apple: Managing your app's life cycle
- Android Developers: The activity life cycle
- Apple Platform Security: Security of runtime process (sandbox)
- Android Open Source Project: Application sandbox
- Android Developers: Permissions on Android
- Apple: App Review
- Apple: Setting up a remote notification server (APNs)
- Firebase Cloud Messaging documentation
- Flutter documentation
- React Native: Core components and native components
- MDN: Progressive web apps
Quiz Unlocks after the last step.