TL;DR: Recording an hour of audio on a phone sounds like one API call. In practice it is a reliability problem: the screen locks, a phone call interrupts, the OS kills the app, the disk fills, the battery dies, and the upload has to cross a weak campus Wi-Fi connection. My rules for any app where a long recording is the core action: configure the audio session for background recording and handle interruptions explicitly, write the recording to disk in short segments so a crash loses seconds and not the whole hour, record in a compressed speech-friendly format at the source, upload segments in the background with resumable retries, and make the recording state impossible to misread in the interface. The user only records a lecture once. If you lose it, there is no second take.
On LectureNotes AI, the AI note-taking app I co-founded, the core action is simple to describe: a student presses record at the start of a lecture, and some time after it ends they get a summary and a clean outline. Everything people talk about is the AI part. But the transcription and the summary are only as good as the audio that reaches the server, and getting a full lecture from a phone on a desk to a server, intact, is its own engineering job.
I touched on this in speech-to-text for lectures vs phone calls, where the point was that the capture path matters more than the model. This post is the practical version: what has to be true for a long recording on a phone to be reliable.
Why long recordings fail
A thirty second voice memo almost never fails. An hour-long recording fails in ways that only show up because of the duration:
- The screen locks a minute in, and the app moves to the background.
- Something interrupts the audio session: an incoming call, an alarm, a voice assistant, another app grabbing the microphone.
- The OS terminates the app under memory pressure while it is in the background.
- Storage runs out halfway through, on a phone that was already nearly full.
- The battery dies, or low power mode changes how aggressively the system treats background work.
- The upload fails on a weak or captive-portal network, and a large single file has to start again from zero.
- The user is not sure it is recording, taps the wrong thing, and stops it by accident.
Each one is rare per minute. Over sixty minutes, across thousands of recordings, every one of them happens daily. And the user usually finds out only after the lecture is over, which is the worst possible time.
Get the audio session right first
Both iOS and Android will let you record in the background, but only if you ask properly.
On iOS, that means the background audio capability in the app's configuration, an audio session category that supports recording, and activating the session before you start. On Android, it means a foreground service with a persistent notification and the microphone service type, because modern Android restricts background microphone access for anything that is not visibly running.
That persistent notification is useful, not just required: it tells the user from the lock screen that the recording is still running.
If you are building in React Native or Flutter, check exactly what your recording library does here rather than assuming. Long background recording is one of the places where I am most likely to drop down to a small native module, the same way I describe in writing native plugins for iOS and Android. A thin native layer that owns the audio session beats a cross-platform package that half-handles it (more in React Native vs Flutter vs native).
Handle interruptions explicitly
An interruption is not a crash, and it should not end the recording silently.
When the system tells you the audio session was interrupted, the recorder should:
- Mark the gap. Close the current segment and record that an interruption started at this time.
- Show it. The interface should say "Recording paused: phone call" in plain words, not keep a timer ticking as if nothing happened.
- Resume when allowed. When the interruption ends, try to reactivate the session and start a new segment. If the system does not allow an automatic resume, tell the user clearly and, where it makes sense, send a local notification so a student who took a call in the corridor knows to come back and tap resume.
- Keep the gap in the data. The server should know there is a missing stretch, so the transcript and summary do not stitch two halves of a lecture together as if they were continuous.
The worst outcome is a recording that quietly stopped at minute twelve while the on-screen timer kept counting.
Write to disk in segments, not one file
This is the single change that removes the most heartache.
If the app writes one big file and only finalizes it when the user presses stop, any crash, kill or battery death before that moment can leave a file that is corrupt or missing entirely. An hour of audio depends on one clean shutdown that may never come.
Instead, I record in short segments, a few minutes each, and finalize every segment as it closes. Each segment gets a sequence number and a start time, and a small local manifest tracks which segments belong to which recording.
What this buys you:
- A crash loses at most one segment, not the session.
- Recovery is possible. On the next launch, the app reads the manifest, finds a recording that never reached "stopped", and offers to keep what was captured: "Your recording from 10:02 was interrupted. We saved 47 minutes. Process it?"
- Uploads can start during the recording, one finished segment at a time, which matters a lot later.
- The server can process segments independently and retry one failed chunk without redoing the hour.
The manifest is the source of truth for local state. Write it atomically, and never delete a segment until the server has confirmed it.
Pick the format at the source
Uncompressed audio from a phone microphone is large, and an hour of it is a painful upload on mobile data. Speech does not need music-grade fidelity.
My default for speech is a compressed format the platform encodes natively, mono, at a sample rate that speech-to-text models handle well. That keeps an hour of audio small enough to upload comfortably while leaving plenty of quality for transcription. Two rules:
- Decide the format once, on the device, and send it as-is. Converting and upsampling on the server costs compute and adds nothing. Upsampled bad audio is still bad audio, just bigger.
- Do not apply aggressive noise suppression on the device unless you have tested that it helps your transcription model. Some on-device processing that sounds cleaner to a human removes detail the model was using.
Smaller files also feed straight into cost. Storage, bandwidth and transcription time all scale with what you upload, and I covered why that matters for free tiers in AI app unit economics.
Upload in the background, resumably
Students record on crowded campus Wi-Fi that drops when they walk between buildings. Uploading one large file in the foreground after the recording ends will fail often and feel slow even when it works.
What works better:
- Upload segments as they finish, so by the time the lecture ends, most of the audio is already on the server.
- Use the platform's background transfer support, so uploads continue when the user closes the app or locks the phone.
- Make every segment upload idempotent. Each segment has a stable ID. If the same segment arrives twice after a retry, the server keeps one.
- Retry with backoff, and prefer Wi-Fi for the big backlog while still allowing the user to push it through on mobile data if they want results now.
- Only delete local audio after the server confirms it has every segment the manifest lists.
When processing finishes, a "your notes are ready" notification is one of the few pushes users genuinely want. I wrote about that pattern in push notifications for a small app.
Make the recording state impossible to misread
Most lost recordings I would call "user error" are really interface errors. A good recording screen answers three questions at a glance, even from across a desk:
- Is it recording right now? A large, unambiguous state, a running timer, and a live level meter that moves when someone speaks. A moving meter is the fastest way for a student to notice the microphone is covered or the phone is in a bag.
- Is anything wrong? Low storage, low battery, an interruption or a permission problem should show as a clear warning before they cost the recording, not after.
- How do I stop on purpose? Stop should be deliberate, with a confirmation or a long press, and it should be hard to hit by accident when the phone is picked up.
Check storage before starting. If there is not enough room for the expected length, say so up front, and keep checking during the session so you can warn before the disk is full rather than failing at minute fifty.
Monitor the pipeline, not just the crashes
Crash reporting catches the loud failures. Most recording failures are quiet: a recording that ended early, a segment that never uploaded, a session with a long gap. These do not crash anything.
So I track recording health as its own set of events: recordings started, recordings stopped normally, recordings recovered after a crash, interruptions per hour of audio, segments uploaded vs segments recorded, and time from stop to "notes ready". A sudden drop in "stopped normally" after a release is a regression even if the crash rate did not move. I go deeper into setting up those alerts in error monitoring and alerting for a small product.
Testing it the way students use it
Simulators hide most of these failures. Before a recording feature ships, I run it on real iOS and Android devices through the ugly cases:
- Lock the screen and leave it for a full hour.
- Take a phone call mid-recording, and decline one.
- Trigger an alarm and a voice assistant.
- Force-kill the app mid-recording, then relaunch and confirm recovery.
- Fill the storage nearly full and start a recording.
- Start in low power mode with a low battery.
- Switch networks during upload, and go fully offline, then back online.
- Update the app while a recording is unuploaded, and confirm the new version still finds and uploads it.
That last one is easy to forget. If the manifest format changes between versions, an update can orphan audio the user cares about. The same "add fields, never repurpose them" rule from keeping old mobile app versions working applies to local data too.
The honest summary
The AI in a lecture-notes app gets the attention, but students do not forgive a lost lecture, whatever the cause. Background audio set up properly, explicit interruption handling, segmented writes with recovery, background resumable uploads and a recording screen nobody can misread are not glamorous. They are what makes the AI part worth anything.
I build mobile apps and AI products for startups in the US, UK and Europe, including the unglamorous capture and upload pipelines that the AI depends on. If your app records audio, video or sensor data and you need it to survive real-world conditions, read more about my background or book a call.