🧠 Android AI Projects and Production

Build an AI Voice-Notes App for Android

Speak for a minute, get a clean transcript, a summary and a list of action items. A voice-notes app combines audio recording, speech-to-text, LLM post-processing and search. Here's the architecture and key code.

✍️ Yunok Tech πŸ“… Updated ⏱ 3 min read 🎯 Intermediate
On this page
  1. Architecture
  2. 1. Record audio
  3. 2. Transcribe
  4. 3. Summarise and extract action items
  5. 4. Process in the background
  6. 5. Store and search
  7. Privacy
  8. Frequently asked questions
  9. Conclusion

Speech to Text covers dictation APIs. This project records audio files and processes them afterwards, which lets you transcribe longer notes, re-process later, and run AI over the result.

Architecture

Voice notes processing pipeline Record audio to an app-private file. A WorkManager job transcribes it, either on device or by sending audio to a multimodal cloud model. Then an LLM produces a title, summary and action items as JSON. Results are saved in Room with full-text search, and the UI shows status per note. Record.m4a, private Transcribeworker Enrichsummary, todos Room+ FTS UI Processing is resumable: each note has a status (recorded β†’ transcribed β†’ enriched).
Background processing means users can record and move on.

1. Record audio

VoiceRecorder.ktKotlin
class VoiceRecorder(private val context: Context) {
    private var recorder: MediaRecorder? = null

    /** Requires RECORD_AUDIO permission granted. */
    fun start(output: File) {
        recorder = MediaRecorder(context).apply {
            setAudioSource(MediaRecorder.AudioSource.MIC)
            setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
            setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
            setAudioSamplingRate(16_000)
            setAudioEncodingBitRate(64_000)
            setOutputFile(output)
            prepare()
            start()
        }
    }

    fun stop() {
        recorder?.runCatching { stop() }       // stop() throws if nothing was recorded
        recorder?.release()
        recorder = null
    }
}
// MediaRecorder(Context) requires API 31+; use the deprecated no-arg constructor on older versions.

Store files in filesDir (app-private). Request RECORD_AUDIO in context. For long recordings in the background, you'd need a foreground service with the microphone type. See Foreground Services.

2. Transcribe

OptionProsCons
Cloud multimodal (Gemini audio input)Works on all devices, handles long audio, can transcribe + summarise togetherAudio leaves the device; cost
ML Kit GenAI Speech Recognition (alpha)On-device, privateAlpha; device and language support limited
Platform SpeechRecognizerBuilt inDesigned for live mic input, not files
Cloud transcription with Gemini (audio as inline data)Kotlin
suspend fun transcribe(model: GenerativeModel, audio: File): String {
    val response = model.generateContent(content {
        inlineData(audio.readBytes(), "audio/mp4")
        text("Transcribe this voice note verbatim. Mark unclear words as [inaudible].")
    })
    return response.text.orEmpty()
}
// Inline data has size limits; for long recordings, split audio or use file upload options per the docs.

3. Summarise and extract action items

NoteEnricher.ktKotlin
@Serializable
data class Enrichment(val title: String, val summary: String, val actionItems: List<String>)

suspend fun enrich(model: GenerativeModel, transcript: String): Enrichment {
    val response = model.generateContent(
        "From this voice note transcript, return JSON with: title (max 6 words), " +
        "summary (max 2 sentences), actionItems (list, only explicit tasks; empty if none). " +
        "Use only information in the transcript.\n\nTranscript:\n$transcript"
    )
    return Json { ignoreUnknownKeys = true }.decodeFromString(response.text.orEmpty())
}
// Configure the model with responseMimeType = "application/json" and a schema for reliability.

4. Process in the background

ProcessNoteWorker.ktKotlin
@HiltWorker
class ProcessNoteWorker @AssistedInject constructor(
    @Assisted ctx: Context, @Assisted params: WorkerParameters,
    private val notes: NoteRepository,
    private val ai: VoiceAi,
) : CoroutineWorker(ctx, params) {
    override suspend fun doWork(): Result {
        val id = inputData.getLong("noteId", -1)
        val note = notes.get(id) ?: return Result.failure()
        return try {
            val transcript = note.transcript ?: ai.transcribe(File(note.audioPath)).also { notes.saveTranscript(id, it) }
            if (note.summary == null) notes.saveEnrichment(id, ai.enrich(transcript))
            Result.success()
        } catch (e: IOException) {
            Result.retry()
        }
    }
}
// Enqueue with a CONNECTED network constraint as unique work per note.

Use Room with an FTS table over title, transcript and summary for instant search. See Room Database. Show per-note status: "Transcribing…", "Ready", "Failed – retry".

Privacy

  • Voice notes can be very personal: explain where audio is processed, and offer on-device mode where supported.
  • Let users delete audio after transcription, and delete everything with one action.
  • Exclude audio from cloud backups if sensitive.
  • See AI Privacy and Data Retention.

Frequently asked questions

Which languages are supported?

Cloud multimodal models support many languages. On-device options are more limited, so check the docs and test with real speakers.

How accurate are transcripts?

Usually good for clear speech, worse with noise, accents and jargon. Let users edit transcripts.

Conclusion

A voice-notes app records to private files, transcribes on device or in the cloud, enriches with summaries and action items as JSON, processes in WorkManager, and stores searchable notes, with privacy controls front and centre.

Next project: an AI Study Assistant.

Official references

πŸ“± Apps built by Yunok Tech

Real Android apps on Google Play, free to download.

See all our apps β†’

Ready to build real Android applications?

Every AI feature still runs inside an Android app that has to be fast, reliable and well structured. Strengthen the Kotlin, Jetpack Compose and architecture skills that AI integrations depend on, then apply these AI concepts with confidence.

Move beyond theory and strengthen your Android development skills with Yunoktech's Android course. Learn core concepts, practical implementation, modern Android development techniques, and the reasoning behind building maintainable applications.

Explore the Android course and take your next step as an Android developer.

Share: LinkedIn X / Twitter WhatsApp