<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx" -->

---
title: Build intelligent Android apps: On-device inference
description: A tutorial on building on-device AI features in Android apps using Gemini Nano 4 via ML Kit&#x27;s Prompt API. Three practical features are demonstrated: trip...
canonical: https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Build intelligent Android apps: On-device inference | daily.dev
og:description: A tutorial on building on-device AI features in Android apps using Gemini Nano 4 via ML Kit&#x27;s Prompt API. Three practical features are demonstrated: trip...
og:url: https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx
og:image: https://api.daily.dev/og/posts/kYNhfi0rX.png
og:image:alt: Build intelligent Android apps: On-device inference
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Build intelligent Android apps: On-device inference

**[Android Developers Blog](https://daily.dev/sources/androiddev)** · 7 min read · 0 upvotes · 0 comments

## Summary

A tutorial on building on-device AI features in Android apps using Gemini Nano 4 via ML Kit's Prompt API. Three practical features are demonstrated: trip itinerary summarization, receipt parsing with structured output using the Structured Output API, and voice note transcription with speech recognition. The post covers prompt optimization using the AICore developer preview, multimodal image understanding for OCR, and combining the Speech Recognition API with the Prompt API. Code samples in Kotlin show how to configure model preferences (FAST vs FULL) and use the @Generable annotation for typed structured output.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://android-developers.googleblog.com/2026/07/android-on-device-inference.html>

## Questions this post answers

### How do I use Gemini Nano with ML Kit's Prompt API to summarize text on-device in Android?

Use ML Kit's Prompt API by configuring a generationConfig with a modelConfig specifying release stage and preference (FAST or FULL), then call Generation.getClient() to get a client and generateContent() with a text prompt. This runs entirely on-device via Gemini Nano, avoiding server calls and enabling features like itinerary summarization without sending data to the cloud.

_Developers building on-device Gemini Nano features track ML Kit API changes and examples on daily.dev._

### How can I get structured output like a Kotlin data class from an on-device Gemini Nano model?

Use ML Kit's Structured Output API by annotating a Kotlin data class with @Generable and @Guide annotations describing each field, then wrap a generateContentRequest with generateTypedContentRequest passing the data class. Gemini Nano 4 then returns a parsed object directly, useful for tasks like extracting title, amount, and category from a receipt image via OCR.

_Developers parsing structured data from on-device LLMs follow implementation patterns like this on daily.dev._

### What is the difference between basic and advanced mode in ML Kit's GenAI Speech Recognition API on Android?

Basic mode uses a traditional on-device speech recognition model and works on most Android devices running API level 31 or higher. Advanced mode uses Gemini Nano for broader language coverage and better transcription quality, but is currently only supported on Pixel 10 devices.

_Developers choosing speech recognition modes for Android voice features track device support details on daily.dev._

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin)

[View this post on daily.dev](https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Build intelligent Android apps: On-device inference","url":"https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx"},"datePublished":"2026-07-21T17:00:08.069Z","dateModified":"2026-09-14T08:20:56.570Z","description":"A tutorial on building on-device AI features in Android apps using Gemini Nano 4 via ML Kit's Prompt API. Three practical features are demonstrated: trip...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e74c1555ab23d6435184593a6947bb9c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e74c1555ab23d6435184593a6947bb9c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Android Developers Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Android Developers Blog","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a3d55bb1d63c48e7bd91b833eb5c2c3c","url":"https://daily.dev/sources/androiddev"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"android,kotlin","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Android Developers Blog","item":"https://daily.dev/sources/androiddev"},{"@type":"ListItem","position":3,"name":"Build intelligent Android apps: On-device inference"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/build-intelligent-android-apps-on-device-inference-kynhfi0rx#faq","mainEntity":[{"@type":"Question","name":"How do I use Gemini Nano with ML Kit's Prompt API to summarize text on-device in Android?","acceptedAnswer":{"@type":"Answer","text":"Use ML Kit's Prompt API by configuring a generationConfig with a modelConfig specifying release stage and preference (FAST or FULL), then call Generation.getClient() to get a client and generateContent() with a text prompt. This runs entirely on-device via Gemini Nano, avoiding server calls and enabling features like itinerary summarization without sending data to the cloud. Developers building on-device Gemini Nano features track ML Kit API changes and examples on daily.dev."}},{"@type":"Question","name":"How can I get structured output like a Kotlin data class from an on-device Gemini Nano model?","acceptedAnswer":{"@type":"Answer","text":"Use ML Kit's Structured Output API by annotating a Kotlin data class with @Generable and @Guide annotations describing each field, then wrap a generateContentRequest with generateTypedContentRequest passing the data class. Gemini Nano 4 then returns a parsed object directly, useful for tasks like extracting title, amount, and category from a receipt image via OCR. Developers parsing structured data from on-device LLMs follow implementation patterns like this on daily.dev."}},{"@type":"Question","name":"What is the difference between basic and advanced mode in ML Kit's GenAI Speech Recognition API on Android?","acceptedAnswer":{"@type":"Answer","text":"Basic mode uses a traditional on-device speech recognition model and works on most Android devices running API level 31 or higher. Advanced mode uses Gemini Nano for broader language coverage and better transcription quality, but is currently only supported on Pixel 10 devices. Developers choosing speech recognition modes for Android voice features track device support details on daily.dev."}}]}
```

