<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yury Camacho on Medium]]></title>
        <description><![CDATA[Stories by Yury Camacho on Medium]]></description>
        <link>https://medium.com/@camachoyury?source=rss-733f859845f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*HDdha9fBMvdk9iyLTJSXgw.png</url>
            <title>Stories by Yury Camacho on Medium</title>
            <link>https://medium.com/@camachoyury?source=rss-733f859845f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:14:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@camachoyury/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Gemma 4 on Android:]]></title>
            <link>https://medium.com/@camachoyury/gemma-4-on-android-9e1aaef22db9?source=rss-733f859845f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e1aaef22db9</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemma-4]]></category>
            <category><![CDATA[ai-on-device]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Yury Camacho]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 02:42:58 GMT</pubDate>
            <atom:updated>2026-04-15T02:42:58.862Z</atom:updated>
            <content:encoded><![CDATA[<h3>Private, Offline AI — No API Keys Required</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2TLXOUiesunCVTGpvBXCA.png" /></figure><p>How to run Gemma 4 E2B on-device on Android with LiteRT-LM: no internet, no server, no inference costs, and your data never leaves the phone.</p><p>The supplier arrives at the store, unloads the boxes and starts dictating: “twelve Cokes 20oz, four Lay’s chips bags, two Tide detergent bottles”. The owner types it on their phone — and needs that to become structured inventory, right now.</p><p>No internet. No waiting. Data stays on the device.</p><p>That’s the problem that led to integrating Gemma 4 directly on Android — and this post covers the real path to get there.</p><p>The full code is at: <a href="https://github.com/camachoyury/Validia">github.com/camachoyury/Validia</a></p><h3>The Use Case: Why Offline Matters</h3><p>The idea was to find a real use case — not just a code example.</p><p>Picture a small store where the supplier arrives, unloads the products and reads out what they brought. That needs to be recorded and turned into inventory on the spot.</p><blockquote>The problem isn’t that store owners don’t have smartphones — they do. The problem is they don’t always have stable internet.</blockquote><p>The user types something like:</p><p>“received 12 Cokes 20oz, 4 bags of Lay’s chips, 2 Tide detergent bottles”</p><p>And the app returns this — without internet:</p><pre>[<br>{ &quot;quantity&quot;: 12, &quot;productName&quot;: &quot;Coca-Cola 20oz&quot;, &quot;category&quot;: &quot;Beverages&quot; },<br>{ &quot;quantity&quot;: 4, &quot;productName&quot;: &quot;Lay&#39;s Chips&quot;, &quot;category&quot;: &quot;Food&quot; },<br>{ &quot;quantity&quot;: 2, &quot;productName&quot;: &quot;Tide Detergent&quot;, &quot;category&quot;: &quot;Cleaning&quot; }<br>]</pre><h3>Why Gemma 4?</h3><p>Gemma is the family of open source language models from Google DeepMind. Unlike models like Gemini — which run in the cloud — Gemma was designed from the ground up to run locally on the device: lightweight weights, aggressive quantization, and hardware acceleration support for GPU and NPU on consumer hardware.</p><p><strong>Gemma 4 </strong>is the most recent generation (April 2026) and the first built explicitly for agentic on-device use cases — reasoning, information extraction, and decision-making without depending on any server.</p><p>It runs on Android through LiteRT LM, Google AI Edge’s inference runtime that compiles the model into a hardware-optimized format (.litertlm) and exposes a native Kotlin API to load and run it.</p><p>The variant used in this project is Gemma 4 E2B — 2.3B parameters, instruction-tuned. At that size:</p><p>- Fits in ~1.4 GB of storage</p><p>- Loads in 2–8 seconds depending on the device</p><p>- Generates responses in 2–4 seconds for short text</p><p><strong>Minimum requirement:</strong> 4 GB RAM, Android 8.0+, 64-bit processor — mid-range devices from 2020 onwards.</p><blockquote><strong>Note on AICore: </strong>Google announced in April 2026 the AICore Developer Preview for Gemma 4 on Android — where the OS manages the model instead of the app. This post uses litertlm-android with the model in assets/ because it offers full control over the version and works without depending on AICore availability on hardware. A follow-up post will cover the migration to AICore with a real comparison of pros, cons and hardware restrictions.</blockquote><h3>Two Paths to Integrate Gemma 4 on Android</h3><p>Google “run Gemma on Android” and 90% of results point to com.google.mediapipe:tasks-genai. And it’s a valid option — MediaPipe has excellent support for .task format models and is the SDK recommended in Google’s official documentation.</p><p>The key is the model format. Two different formats for two different runtimes:</p><p>.task → com.google.mediapipe:tasks-genai → models from AI Studio / MediaPipe Model Maker</p><p>.litertlm → <a href="http://com.google.ai/">com.google.ai</a>.edge.litertlm:litertlm-android → models from the LiteRT community on Hugging Face</p><p><strong>Use <em>litertlm-android</em> if:</strong></p><p>- The model comes from the LiteRT community on Hugging Face (.litertlm format)</p><p>- You want a native Kotlin API with Flow&lt;Message&gt; and less integration boilerplate</p><ul><li>You don’t need to combine the LLM with MediaPipe vision or audio pipelines</li></ul><pre>implementation(com.google.ai.edge.litertlm:litertlm-android)</pre><p><strong>Use <em>mediapipe:tasks-genai</em> if:</strong></p><p>- The model comes from AI Studio or was created with MediaPipe Model Maker (.task format)</p><p>- You need more documentation, examples and community support</p><ul><li>You’re already using MediaPipe for other tasks (object detection, pose, etc.) in the same app</li></ul><pre>implementation(com.google.mediapipe:tasks-genai)</pre><p>The model used in this project — <strong>gemma-4-E2B-it.litertlm —</strong> is in native LiteRT format. That’s why litertlm-android was chosen: it’s the right SDK for that format, with a cleaner Kotlin API (Flow&lt;Message&gt; native, internal chat template, automatic EOS token) and no workarounds to maintain.</p><h4>The Right SDK: litertlm-android</h4><p>The README for the model on Hugging Face (a leading open-source platform and community for artificial intelligence and machine learning) mentions the following:</p><blockquote>“This model is in LiteRT LM format. Use the litertlm-android SDK to run it on Android.”</blockquote><p><strong>litertlm-android</strong> is open source (<a href="http://github.com/google-ai-edge/LiteRT-LM">github.com/google-ai-edge/LiteRT-LM</a>), published on Google Maven (already configured in any Android project) and used internally by Google in Chrome, Chromebook Plus and Pixel Watch.</p><h3>Let’s Build It</h3><h4>Step 1: Get the Model</h4><p>Download the file gemma-4-E2B-it.litertlm from:</p><p><a href="https://huggingface.co/litert-community/gemma-4-E2B-it-litert-lm">litert-community/gemma-4-E2B-it-litert-lm · Hugging Face</a></p><p>Place it in the project’s assets/ folder:</p><pre>app/src/main/assets/<br>└── gemma-4-E2B-it.litertlm<br>/*<br>⚠️ The file size is 1.4 GB.** On the first boot, it is copied to `filesDir`.<br>This may take 20–60 seconds. Subsequent boots are instantaneous.<br>*/</pre><h4>Step 2: Gradle</h4><p>Two critical things: the dependency and noCompress:</p><pre>android {<br>    androidResources {<br>        noCompress += &quot;litertlm&quot; // without this the SDK can&#39;t read the file<br>    }<br>}</pre><pre>dependencies {<br>    implementation(&quot;com.google.ai.edge.litertlm:litertlm-android:0.10.0&quot;)<br>    implementation(&quot;org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1&quot;)<br>}</pre><h4>Step 3: Load the Model</h4><p>Engine needs a physical file path — it can’t read from assets/ directly. Android’s assets don’t have a directly accessible physical path, they can only be opened as an InputStream. ModelCopier does this copy once on first launch, and from then on the file lives in filesDir with its physical path.</p><pre>// Idempotent copy: if it already exists, doesn&#39;t copy again<br>val physicalPath = ModelCopier<br>                     .ensureModelReady(context, &quot;gemma-4-E2B-it.litertlm&quot;)<br><br>val engine = Engine(EngineConfig(<br>    modelPath  = physicalPath,<br>    backend    = Backend.CPU(),  // Backend.GPU() if the device supports it<br>    cacheDir   = context.cacheDir.path  // 3–5x faster on second load<br>))<br>engine.initialize()</pre><h4>Step 4: Inference</h4><p>This is where <strong>litertlm-android </strong>shines. The SDK applies Gemma IT’s chat template internally — no need to manually build &lt;start_of_turn&gt;user…&lt;end_of_turn&gt;. Inference is a native Kotlin Flow&lt;Message&gt;:</p><pre>val conversationConfig = ConversationConfig(<br>    systemInstruction = Contents.of(systemPrompt),<br>    samplerConfig = SamplerConfig(<br>        topK        = 1,<br>        topP        = 0.9,   // Double - no Float<br>        temperature = 0.1,   // Double - no Float<br>        seed        = 0<br>    )<br>)<br><br>engine.createConversation(conversationConfig).use { conversation -&gt;<br>    conversation<br>        .sendMessageAsync(userInput)<br>        .collect { message -&gt; accumulated.append(message.toString()) }<br>}<br>// Use {} automatically closes resources when the Flow completes. <br>//The Flow completes when Gemma issues her native EOS token. No manual early-stop, no callbacks, no future listeners.</pre><p>The Flow completes when Gemma emits its native EOS token. No manual early-stop, no callbacks, no future listeners.</p><h4>Enable GPU (optional)</h4><p>To use Backend.GPU() instead of Backend.CPU(), add this inside &lt;application&gt; in AndroidManifest.xml:</p><pre>&lt;!--android:required=&quot;false&quot; ensures the<br> app installs on devices without OpenCL support too --&gt;<br><br>&lt;uses-native-library android:name=&quot;libvndksupport.so&quot; android:required=&quot;false&quot;/&gt;<br>&lt;uses-native-library android:name=&quot;libOpenCL.so&quot;       android:required=&quot;false&quot;/&gt;</pre><p>Then change backend = Backend.CPU() to backend = Backend.GPU() in EngineConfig. The cacheDir is especially important for GPU — it caches the compiled GPU kernels and makes the second load 3–5x faster.</p><h4>Logcat during a real inference:</h4><pre>D Gemma4Debug: ════════════════════════════════════════<br>D Gemma4Debug: GEMMA 4 E2B - NEW INFERENCE<br>V Gemma4Debug: [token] [{&quot;quantity&quot;:12,&quot;productName&quot;:&quot;Coca Cola 2L&quot;,&quot;category&quot;:&quot;Beverages&quot;},…]<br>D Gemma4Debug: ✅ Inference completed in 2840ms<br>D Gemma4Debug: ════════════════════════════════════════</pre><h4>Step 5: The Prompt</h4><p>For a 2.3B parameter model, few-shot prompting — concrete input/output examples — is the technique with the most impact on quality.</p><p>Large models (70B+) generalize well: they understand the intent even if the prompt is vague. Small models don’t have that margin — they depend on the explicit context given in the prompt to “anchor” the format and domain. Without examples, Gemma 4 E2B may return the correct result wrapped in explanatory text, with markdown, or in a different language. With two domain-specific examples, the output is consistent and directly parseable:</p><pre>private val systemInstructions = &quot;&quot;&quot;<br>        You are an inventory assistant for stores and warehouses.<br>        Your only job is to extract products from a text and return them as JSON.<br><br>        STRICT RULES:<br>        - Return ONLY a valid JSON array. No extra text, no markdown.<br>        - Each object: &quot;quantity&quot; (Int), &quot;productName&quot; (String), &quot;category&quot; (String).<br>        - &quot;category&quot; MUST be one of: &quot;Beverages&quot;, &quot;Food&quot; or &quot;Cleaning&quot;.<br>        - If you cannot classify a product, default to &quot;Food&quot;.<br><br>        EXAMPLES:<br><br>        Input: &quot;got 24 Coca-Cola 20oz and 6 bags of Lay&#39;s chips&quot;<br>        Output: [{&quot;quantity&quot;:24,&quot;productName&quot;:&quot;Coca-Cola 20oz&quot;,&quot;category&quot;:&quot;Beverages&quot;},{&quot;quantity&quot;:6,&quot;productName&quot;:&quot;Lay&#39;s Chips&quot;,&quot;category&quot;:&quot;Food&quot;}]<br><br>        Input: &quot;order 4 Tide detergent and 3 bottles of vegetable oil&quot;<br>        Output: [{&quot;quantity&quot;:4,&quot;productName&quot;:&quot;Tide Detergent&quot;,&quot;category&quot;:&quot;Cleaning&quot;},{&quot;quantity&quot;:3,&quot;productName&quot;:&quot;Vegetable Oil&quot;,&quot;category&quot;:&quot;Food&quot;}]<br><br>        Now process the following text:<br>    &quot;&quot;&quot;.trimIndent()<br><br>val rawResponse = engine.generate(<br>    systemPrompt = systemInstructions,<br>    userInput = rawText<br>)</pre><h4>Step 6: Parse the Response</h4><p>The model returns a String. Extract the JSON array and deserialize with kotlinx.serialization:</p><pre>// Defensive extraction: finds first &#39;[&#39; and last &#39;]&#39;<br>val cleanJson = rawResponse.substring(<br>    rawResponse.indexOf(&#39;[&#39;),<br>    rawResponse.lastIndexOf(&#39;]&#39;) + 1<br>)<br>val items = Json { ignoreUnknownKeys = true; isLenient = true }<br>    .decodeFromString&lt;List&lt;InventoryItem&gt;&gt;(cleanJson)</pre><h4>Step 7: The UI — Only What Matters</h4><p>The full screen flow is simple — an OutlinedTextField for input, a button that triggers inference and a when over the state:</p><pre>OutlinedTextField(<br>    value = rawText,<br>    onValueChange = onRawTextChange,<br>    label = { Text(&quot;Supplier text&quot;) },<br>    placeholder = { Text(&quot;E.g.: 12 Cokes 20oz, 4 Lay&#39;s chips, 2 Tide detergent…&quot;) },<br>    modifier = Modifier.fillMaxWidth().heightIn(min = 180.dp)<br>)<br><br>Button(<br>    onClick = { onProcessClick(rawText) },<br>    enabled = uiState is InventoryUiState.Ready &amp;&amp; rawText.isNotBlank(),<br>    modifier = Modifier.fillMaxWidth()<br>) { Text(&quot;Process with Gemma 4&quot;) }</pre><p>The rest of the UI — result cards, category chips, loading states — is in the <a href="https://github.com/camachoyury/Validia">repository</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*26bEl4to2F0x8UXuQKsbrg.gif" /></figure><h4>Key Takeaways</h4><p>The file extension determines the SDK.</p><blockquote>.litertlm → litertlm-android.</blockquote><blockquote>.task → mediapipe:tasks-genai.</blockquote><p>Worth reading before writing the first line of code.</p><p><strong>litertlm-android </strong>is idiomatic Kotlin.Flow&lt;Message&gt;, use {}, native coroutines — no callbacks, no Java futures. Few-shot prompting on a small model = surprisingly good results.</p><p><strong>Gemma 4 E2B</strong> recognizes abbreviations, brand names and spelling variations with great accuracy when the prompt includes domain-specific examples — regardless of the market.</p><h3>What’s Next</h3><ul><li>AICore: migrate this example so the OS manages the model — real comparison of pros, cons and hardware restrictions.</li><li>CameraX: photograph invoices and have Gemma transcribe them directly.</li><li>Play Asset Delivery: lightweight APK + model downloaded in the background.</li></ul><blockquote>A model file’s extension isn’t a detail — it’s the decision that defines which SDK to use.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e1aaef22db9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gemma 4 en Android]]></title>
            <link>https://medium.com/@camachoyury/gemma-4-en-android-c6818a75fa3d?source=rss-733f859845f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6818a75fa3d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemma-4]]></category>
            <category><![CDATA[ai-on-device]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Yury Camacho]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 02:31:39 GMT</pubDate>
            <atom:updated>2026-04-15T02:31:39.222Z</atom:updated>
            <content:encoded><![CDATA[<h3>IA Privada, offline, y sin API Keys — directo en el dispositivo</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2TLXOUiesunCVTGpvBXCA.png" /></figure><blockquote>Cómo correr Gemma 4 E2B on-device en Android con LiteRT-LM: sin internet, sin servidor, sin costos de inferencia y sin que los datos salgan del teléfono.</blockquote><p>El proveedor llega a la bodega, descarga los cajones y empieza a dictar: “doce cocas de dos litros, cinco maples de huevo, tres lejías al toque”. El dueño lo escribe en su celular — y necesita que eso se convierta en un inventario estructurado, ahora mismo.<br>Sin internet. Sin esperar. Sin que esos datos salgan del dispositivo.<br>Ese es el problema que llevó a integrar Gemma 4 directamente en Android — y este post cuenta el camino real para lograrlo.</p><p>El codigo fuente esta en: <a href="https://github.com/camachoyury/Validia">github.com/camachoyury/Validia</a></p><h3>El caso de uso: Por que offline importa</h3><p>la idea era buscar un caso de uso de esto y no quedarnos en solo el ejemplo de código.</p><p>supongamos que hay una bodega donde el proveedor llega, descarga los productos y los dicta en voz alta lo que trajo y eso debe anotarse e inventariarse.</p><blockquote>El problema no es que no tengan smartphones, los tienen!. El problema es que “no siempre tiene internet estable”.</blockquote><p>El usuario escribe algo como :</p><p>-“llegaron 12 cocas de 2 litros, 4 yerbas Taragüi 500g, 2 packs de jabón Ala””</p><p>Y la app debería devolver algo como esto (<strong>sin internet</strong>):</p><pre><br>[<br>  { &quot;quantity&quot;: 12, &quot;productName&quot;: &quot;Coca Cola 2L&quot;,      &quot;category&quot;: &quot;Bebidas&quot;   },<br>  { &quot;quantity&quot;: 4,  &quot;productName&quot;: &quot;Yerba Taragüi 500g&quot;,&quot;category&quot;: &quot;Alimentos&quot; },<br>  { &quot;quantity&quot;: 2,  &quot;productName&quot;: &quot;Jabón Ala&quot;,         &quot;category&quot;: &quot;Limpieza&quot;  }<br>]</pre><h3>¿Por que Gemma 4?</h3><p>Gemma es la familia de modelos de lenguaje open source de Google DeepMind. A diferencia de modelos como Gemini — que corren en la nube — Gemma fue diseñada desde el principio para correr localmente en el dispositivo: pesos livianos, cuantización agresiva y soporte para aceleración por GPU y NPU en hardware de consumo.</p><p><strong>Gemma 4</strong> es la generación más reciente (abril 2026) y la primera pensada explícitamente para casos de uso agentic on-device — razonamiento, extracción de información y toma de decisiones sin depender de ningún servidor.<br>Corre en Android gracias a LiteRT LM, el runtime de inferencia de Google AI Edge que compila el modelo a un formato optimizado para el hardware del dispositivo (.litertlm) y expone una API Kotlin nativa para cargarlo y ejecutarlo.<br>La variante elegida para este proyecto es Gemma 4 E2B — 2.3B parámetros, instruction-tuned. Con ese tamaño:</p><p>- Cabe en ~1.4 GB de almacenamiento<br>- Carga en 2–8 segundos según el dispositivo<br>- Genera respuestas en 2–4 segundos para texto corto</p><p><strong>Requisito mínimo:</strong> 4 GB de RAM, Android 8.0+, procesador 64-bit — gama media desde 2020 en adelante.</p><p><strong><em>Nota sobre AICore</em></strong><em>: Google anunció en abril de 2026 el AICore Developer Preview para Gemma 4 en Android — donde el SO gestiona el modelo en lugar de la app. En este post se usa litertlm-android con el modelo en assets/ porque ofrece control total sobre la versión y funciona sin depender de la disponibilidad de AICore en el hardware. En un próximo post se verá la migración a AICore con la comparativa real de pros, contras y restricciones.</em></p><h4><strong>Dos Caminos para Integrar Gemma 4 en Android</strong></h4><p>Googleá “run Gemma on Android” y el 90% de los resultados apuntan a <em>com.google.mediapipe:tasks-genai</em>. Y es una opción válida — MediaPipe tiene excelente soporte para modelos en formato <em>.task</em> y es el SDK recomendado en la documentación oficial de Google.<br>El punto clave es el formato del modelo. Hay dos formatos distintos para dos runtimes distintos:</p><p>Más allá del formato, cada SDK tiene su lugar dependiendo del contexto:</p><h4>Usá litertlm-android si:</h4><p>• El modelo viene de la comunidad LiteRT en Hugging Face (formato .litertlm)<br>• Querés una API Kotlin nativa con Flow&lt;Message&gt; y menos código de integración<br>• No necesitás combinar el LLM con pipelines de visión o audio de MediaPipe<br>com.google.mediapipe:tasks-genai</p><pre>implementation(com.google.ai.edge.litertlm:litertlm-android)</pre><h4>Usá mediapipe:tasks-genai si:</h4><ul><li>El modelo viene de AI Studio o fue creado con MediaPipe Model Maker (formato .task)<br>• Necesitás más documentación, ejemplos y soporte de la comunidad<br>• Ya usás MediaPipe para otras tareas (detección de objetos, pose, etc.) en la misma app</li></ul><pre>implementation(com.google.mediapipe:tasks-genai)</pre><p>El modelo elegido para este proyecto — <strong>gemma-4-E2B-it.litertlm</strong> — está en formato LiteRT nativo. Por eso se optó por litertlm-android: es el SDK correcto para ese formato, con una API Kotlin más limpia (Flow&lt;Message&gt; nativo, chat template interno, EOS token automático) y sin workarounds que mantener.</p><h3>El SDK Correcto: litertlm-android</h3><p>En el README del modelo en <strong>Hugging Face </strong>(plataforma y comunidad líder de código abierto para inteligencia artificial y aprendizaje automático) menciona lo siguiente:</p><blockquote><em>“This model is in LiteRT LM format. Use the litertlm-android SDK to run it on Android.”</em></blockquote><p><strong>litertlm-android </strong>es open source (<a href="http://github.com/google-ai-edge/LiteRT-LM"><em>github.com/google-ai-edge/LiteRT-LM</em></a>), publicado en Google Maven (ya configurado en cualquier proyecto Android) y usado internamente por Google en Chrome, Chromebook Plus y Pixel Watch.</p><h3>Manos a la obra</h3><h4>Paso 1: Conseguir el Modelo</h4><p>es necesario descargar desde el siguiente link el archivo “gemma-4-E2B-it.litertlm”</p><p><a href="https://huggingface.co/litert-community/gemma-4-E2B-it-litert-lm/tree/main">litert-community/gemma-4-E2B-it-litert-lm at main</a></p><p>El archivo va en la carpeta <strong>assets/ </strong>del proyecto:</p><pre>app/src/main/assets/<br>└── gemma-4-E2B-it.litertlm<br>/*<br> ⚠️ El archivo pesa 1.4 GB.** En el primer arranque se copia a `filesDir` <br> puede tardar 20–60 segundos. Los arranques siguientes son instantáneos. <br>*/</pre><h4>Paso 2: Gradle</h4><p>Dos cosas críticas: la dependencia y el noCompress:</p><pre>android {<br>    androidResources {<br>        noCompress += &quot;litertlm&quot; // sin esto el SDK no puede leer el archivo<br>    }<br>}</pre><pre>dependencies {<br>    implementation(&quot;com.google.ai.edge.litertlm:litertlm-android:0.10.0&quot;)<br>    implementation(&quot;org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1&quot;)<br>}</pre><h4>Paso 3: Cargar el Modelo</h4><p>Engine necesita una ruta física — no puede leer de assets/ directamente. Se copia una sola vez con ModelCopier:</p><pre>// Copia idempotente: si ya existe, no vuelve a copiar<br>val physicalPath = ModelCopier<br>                     .ensureModelReady(context, &quot;gemma-4-E2B-it.litertlm&quot;)<br><br>val engine = Engine(EngineConfig(<br>    modelPath  = physicalPath,<br>    backend    = Backend.CPU(),  // Backend.GPU() si el dispositivo lo soporta<br>    cacheDir   = context.cacheDir.path  // 3-5x más rápido en la segunda carga<br>))<br>engine.initialize()</pre><h4>Paso 4: La Inferencia</h4><p>Acá es donde <strong>litertlm-android</strong> brilla. El SDK aplica el chat template de Gemma IT internamente — no hace falta construir &lt;start_of_turn&gt;user…&lt;end_of_turn&gt; a mano. La inferencia es un Flow&lt;Message&gt; nativo de Kotlin:</p><pre>val conversationConfig = ConversationConfig(<br>    systemInstruction = Contents.of(systemPrompt),<br>    samplerConfig = SamplerConfig(<br>        topK        = 1,<br>        topP        = 0.9,   // Double — no Float<br>        temperature = 0.1,   // Double — no Float<br>        seed        = 0<br>    )<br>)<br><br>engine.createConversation(conversationConfig).use { conversation -&gt;<br>    conversation<br>        .sendMessageAsync(userInput)<br>        .collect { message -&gt; accumulated.append(message.toString()) }<br>}<br>// use {} cierra los recursos automáticamente cuando el Flow completaEl Flow se completa cuando Gemma emite su token EOS nativo. Sin early-stop manual, sin callbacks, sin future listeners.</pre><p><strong><em>Habilitar GPU (opcional):</em></strong></p><p>Para usar `Backend.GPU()` en lugar de `Backend.CPU()`, agregar en `AndroidManifest.xml` dentro de `&lt;application&gt;`</p><pre><br>&lt;!-- android:required=&quot;false&quot; garantiza que la app se instale<br>     también en dispositivos sin soporte OpenCL. --&gt;<br>&lt;uses-native-library android:name=&quot;libvndksupport.so&quot; android:required=&quot;false&quot;/&gt;<br>&lt;uses-native-library android:name=&quot;libOpenCL.so&quot;       android:required=&quot;false&quot;/&gt;<br></pre><p>Después cambiar `backend = Backend.CPU()` por `backend = Backend.GPU()` en `EngineConfig`. El `cacheDir` es especialmente importante para GPU — guarda en caché los kernels compilados y hace que la <em>segunda carga sea 3–5x más rápida.</em></p><p><strong>Logcat durante una inferencia real</strong></p><pre>D Gemma4Debug: ════════════════════════════════════════<br>D Gemma4Debug:   GEMMA 4 E2B — NUEVA INFERENCIA<br>V Gemma4Debug:   [token] [{&quot;quantity&quot;:12,&quot;productName&quot;:&quot;Coca Cola 2L&quot;,&quot;category&quot;:&quot;Bebidas&quot;}]<br>D Gemma4Debug:   ✅ Inferencia completada en 2840ms<br>D Gemma4Debug: ════════════════════════════════════════</pre><h4>Paso 5: El Prompt</h4><p>Para un modelo de 2.3B parámetros, el few-shot prompting — ejemplos concretos de entrada y salida — es la técnica que más impacto tiene sobre la calidad:</p><p>Los modelos grandes (70B+) generalizan bien: entienden la intención aunque el prompt sea vago. Los modelos pequeños no tienen ese margen — dependen del contexto explícito que se les da en el prompt para “anclar” el formato y el dominio. Sin ejemplos, Gemma 4 E2B puede devolver el resultado correcto envuelto en texto explicativo, con markdown, o en un idioma distinto. Con dos ejemplos del dominio concreto, el output es consistente y parseable directamente:</p><pre>private val systemInstructions = &quot;&quot;&quot;<br>    Eres un asistente de inventario para tiendas y bodegas.<br>    Extrae productos de un texto y devuélvelos en JSON.<br><br>    REGLAS:<br>    - Devuelve ÚNICAMENTE un array JSON. Sin texto extra, sin markdown.<br>    - Campos: &quot;quantity&quot; (Int), &quot;productName&quot; (String), &quot;category&quot; (String).<br>    - &quot;category&quot; SOLO puede ser: &quot;Bebidas&quot;, &quot;Alimentos&quot; o &quot;Limpieza&quot;.<br><br>    EJEMPLOS:<br>    Entrada: &quot;llegaron 24 quilmes litro y 6 yerbas Rosamonte 1kg&quot;<br>    Salida: [{&quot;quantity&quot;:24,&quot;productName&quot;:&quot;Cerveza Quilmes 1L&quot;,&quot;category&quot;:&quot;Bebidas&quot;},{&quot;quantity&quot;:6,&quot;productName&quot;:&quot;Yerba Rosamonte 1kg&quot;,&quot;category&quot;:&quot;Alimentos&quot;}]<br><br>    Ahora procesa el siguiente texto:<br>&quot;&quot;&quot;.trimIndent()<br>// El SDK arma el turno del usuario internamente<br>val rawResponse = engine.generate(<br>    systemPrompt = systemInstructions,<br>    userInput    = rawText<br>)<br></pre><h4>Paso 6: Parsear la Respuesta</h4><p>El modelo devuelve un String. Se extrae el JSON array y se deserializa con kotlinx.serialization:</p><pre>// Extracción defensiva: busca primer &#39;[&#39; y último &#39;]&#39;<br>val cleanJson = rawResponse.substring(<br>    rawResponse.indexOf(&#39;[&#39;),<br>    rawResponse.lastIndexOf(&#39;]&#39;) + 1<br>)<br>val items = Json { ignoreUnknownKeys = true; isLenient = true }<br>    .decodeFromString&lt;List&lt;InventoryItem&gt;&gt;(cleanJson)</pre><h4>Paso 7: La UI, Solo lo Relevante</h4><p>El flujo completo de la pantalla es simple — un <strong><em>OutlinedTextField</em></strong> para el input, un botón que dispara la inferencia y un when sobre el estado:</p><pre>OutlinedTextField(<br>    value = rawText,<br>    onValueChange = onRawTextChange,<br>    label = { Text(&quot;Texto del proveedor&quot;) },<br>    placeholder = { Text(&quot;Ej: 12 cocas, 4 yerbas Taragüi, 2 Ala...&quot;) },<br>    modifier = Modifier.fillMaxWidth().heightIn(min = 180.dp)<br>)<br><br>Button(<br>    onClick = { onProcessClick(rawText) },<br>    enabled = uiState is InventoryUiState.Ready &amp;&amp; rawText.isNotBlank(),<br>    modifier = Modifier.fillMaxWidth()<br>) { Text(&quot;Procesar con Gemma 4&quot;) }</pre><p>El resto de la UI — cards de resultados, chips de categoría, estados de carga — está en el <a href="https://github.com/camachoyury/Validia">repositorio</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*6VP5Bh92rAqMybKV3XtFbA.gif" /><figcaption>app corriendo</figcaption></figure><h3>Lo Que Quedó Claro</h3><p>El formato del archivo determina el SDK.</p><blockquote><em>.litertlm</em> → <em>litertlm-android.</em></blockquote><blockquote>.task → mediapipe:tasks-genai.</blockquote><p>Vale leerlo antes de escribir la primera línea de código.<br><strong>litertlm-android </strong>es Kotlin idiomático. Flow&lt;Message&gt;, use {}, corrutinas nativas — sin callbacks ni Java futures.<br>Few-shot prompting sobre modelo pequeño = resultados sorprendentes.</p><p><strong>Gemma 4 E2B</strong> reconoce abreviaciones, marcas locales y variaciones ortográficas en español con muy buena precisión cuando el prompt incluye ejemplos del dominio.</p><h3>Próximos Pasos</h3><ul><li>AICore: migrar este mismo ejemplo para que el SO gestione el modelo — comparativa real de pros, contras y restricciones de hardware.</li><li>CameraX: fotografiar facturas y que Gemma transcriba directamente.</li><li>Play Asset Delivery: APK liviano + modelo descargado en background.</li></ul><blockquote>La extensión de un archivo de modelo no es un detalle — es la decisión que define qué SDK usar.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6818a75fa3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Live Updates en Android 16: Implementando ProgressStyle para Notificaciones]]></title>
            <link>https://medium.com/@camachoyury/live-updates-en-android-16-implementando-progressstyle-para-notificaciones-0830710829d7?source=rss-733f859845f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/0830710829d7</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[live-updates]]></category>
            <category><![CDATA[koltin]]></category>
            <dc:creator><![CDATA[Yury Camacho]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 02:10:27 GMT</pubDate>
            <atom:updated>2025-10-09T02:15:23.392Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Explorando las nuevas capacidades de notificaciones avanzadas con un ejemplo práctico</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*wGelYGh0QP2xVuwgxmCCtA.png" /></figure><h4><strong>🚀 Introducción</strong></h4><p>Con el anuncio de Android 16 en Google I/O 2025, Google introdujo una nueva API revolucionaria: <strong>Notification.ProgressStyle</strong>. Esta funcionalidad permite crear notificaciones con barras de progreso avanzadas, segmentos de colores personalizados, puntos de referencia y iconos que se mueven dinámicamente con el progreso.</p><p>En este artículo, exploraremos cómo implementar estas nuevas capacidades a través de una aplicación de demostración de delivery de comida que muestra el progreso de entrega en tiempo real usando las Live Updates de Android 16.</p><h4><strong>📱 ¿Qué son las Live Updates de Android 16?</strong></h4><p>Las Live Updates representan la evolución natural de las notificaciones de progreso. Mientras que las notificaciones tradicionales solo mostraban una barra de progreso básica, Android 16 introduce:</p><p>- <strong>Progress Tracker Icons</strong>: Iconos personalizados que se mueven con el progreso.</p><p>- <strong>Progress Segments</strong>: Segmentos de la barra con colores diferentes.</p><p>- <strong>Progress Points</strong>: Puntos de referencia en posiciones específicas.</p><p>- <strong>Promoted Notifications</strong>: Permisos especiales para notificaciones persistentes.</p><h4><strong>🏗️ Arquitectura de la Aplicación</strong></h4><p><strong>Tecnologías Utilizadas</strong></p><p>- <strong>Jetpack Compose</strong> para la interfaz de usuario moderna</p><p>- <strong>MVVM </strong>con StateFlow para gestión de estado</p><p>- <strong>Kotlin Coroutines</strong> para simulación asíncrona</p><p><strong>Estados del Delivery</strong></p><p>Nuestra implementación utiliza <strong>3 estados optimizados</strong> para una mejor experiencia de usuario:</p><p><strong>Preparando </strong>25% -&gt; El pedido está siendo preparado (10 segundos )</p><p><strong>En Camino</strong>75% -&gt; El repartidor está en ruta (3 segundos )</p><p><strong>Entregado </strong>100% -&gt; Pedido completado (Auto-cancelación )</p><p><strong>🔧 Implementación Técnica</strong></p><p><strong>1. Configuración del Proyecto</strong></p><pre>//build.gradle.kts<br><br>android {<br><br>  compileSdk = 36 // Android 16<br>  targetSdk = 36<br>}<br><br>dependencies {<br><br>  implementation(&quot;androidx.core:core-ktx:1.12.0&quot;)<br>  implementation(&quot;androidx.compose.ui:ui:1.5.4&quot;)<br>  implementation(&quot;androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0&quot;)<br>}</pre><p><strong>2. Permisos Requeridos</strong></p><pre>&lt;! - AndroidManifest.xml →<br><br>&lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot; /&gt;<br>&lt;uses-permission android:name=&quot;android.permission.POST_NOTIFICATIONS&quot; /&gt;<br>&lt;uses-permission android:name=&quot;android.permission.CALL_PHONE&quot; /&gt;</pre><p><strong>3. Verificación de Promoted Notifications</strong></p><pre>@RequiresApi(Build.VERSION_CODES.BAKLAVA)<br>fun checkPromotedNotificationsPermission(): Boolean {<br>  return try {<br>      notificationManager.canPostPromotedNotifications()<br>  } catch (e: Exception) {<br>        false<br>  }<br>}</pre><p><strong>4. Creación del ProgressStyle Avanzado</strong></p><pre>@RequiresApi(Build.VERSION_CODES.BAKLAVA)<br>private fun createProgressStyleForState(state: OrderState): Notification.ProgressStyle {<br>    // 3 segmentos para 3 estados (25%, 50%, 25%)<br>    val segments = listOf(<br>        Notification.ProgressStyle.Segment(25).setColor(Color.BLUE),<br>        Notification.ProgressStyle.Segment(50).setColor(Color.CYAN),<br>        Notification.ProgressStyle.Segment(25).setColor(Color.RED)<br>        )<br><br>    // Usamos dos puntos para marcar PREPARING (25) y ON_WAY (75)<br>    val points = when (state) {<br>        OrderState.PREPARING -&gt; listOf(<br>            Notification.ProgressStyle.Point(25).setColor(Color.GREEN)<br>        )<br><br>        OrderState.ON_WAY -&gt; listOf(<br>            Notification.ProgressStyle.Point(25).setColor(Color.GREEN),<br>            Notification.ProgressStyle.Point(75).setColor(Color.GREEN)<br>        )<br><br>        OrderState.DELIVERED -&gt; listOf(<br>             Notification.ProgressStyle.Point(25).setColor(Color.GREEN),<br>             Notification.ProgressStyle.Point(75).setColor(Color.GREEN)<br>        )<br>    }<br>    // Según el estado, la barra se llenará:<br>    val progress = when (state) {<br>        OrderState.PREPARING -&gt; 25   // 25% si está preparándose <br>        OrderState.ON_WAY -&gt; 75      // 75% si va en camino<br>        OrderState.DELIVERED -&gt; 100  // 100% si ha sido entregado<br>    }<br><br>    // Icono del repartidor que se mueve con el progreso<br>    val trackerIcon =<br>        IconCompat.createWithResource(appContext, R.drawable.ic_delivery).toIcon(appContext)<br>     <br>    return Notification.ProgressStyle()<br>           .setStyledByProgress(false)<br>           .setProgress(progress)<br>           .setProgressTrackerIcon(trackerIcon)<br>           .setProgressSegments(segments)<br>           .setProgressPoints(points)<br>    }<br>}</pre><p><strong>5. Construcción de Notificaciones por Estado</strong></p><p><strong>Estado 1: Preparando (25%)</strong></p><pre>private fun buildPreparingNotificationWithProgress(): Notification {<br>    <br>    val style = createProgressStyleForState(OrderState.PREPARING)<br><br>    return Notification.Builder(appContext, CHANNEL_ID)<br>          .setSmallIcon(R.drawable.ic_delivery)<br>          .setContentTitle(&quot;Tu pedido está siendo preparado&quot;)<br>          .setContentText(&quot;Próximo paso: entrega&quot;)<br>          .setOngoing(true)<br>          .setStyle(style)<br>          .addAction(createCallAction())<br>          .addAction(createMessageAction())<br>          .build()<br>    }</pre><p><strong>Estado 2: En Camino (75%)</strong></p><pre>private fun buildEnRouteNotificationWithProgress(): Notification {<br><br>    val style = createProgressStyleForState(OrderState.ON_WAY)<br><br>    return Notification.Builder(appContext, CHANNEL_ID)<br>          .setSmallIcon(R.drawable.ic_delivery)<br>          .setContentTitle(&quot;Tu pedido está en camino&quot;)<br>          .setContentText(&quot;En ruta hacia tu destino&quot;)<br>          .setOngoing(true)<br>          .setStyle(style)<br>          .addAction(createCallAction())<br>          .addAction(createMessageAction())<br>          .build()<br>}</pre><p><strong>Estado 3: Entregado (100%)</strong></p><pre>private fun buildDeliveredNotificationWithProgress(): Notification {<br><br>    val style = createProgressStyleForState(OrderState.DELIVERED)<br>    <br>    return Notification.Builder(appContext, CHANNEL_ID)<br>          .setSmallIcon(R.drawable.ic_delivery)<br>          .setContentTitle(&quot;¡Tu pedido ha sido entregado!&quot;)<br>          .setContentText(&quot;Gracias por usar Lentti Delivery&quot;)<br>          .setOngoing(false)<br>          .setAutoCancel(true)<br>          .setStyle(style)<br>          .build()<br>    }</pre><h4><strong>🎨 Sincronización UI-Notificaciones</strong></h4><p>Una de las características más importantes de la App es la <strong>perfecta sincronización</strong> entre la interfaz de usuario y las notificaciones.</p><p><strong>Barra de Progreso en la UI</strong></p><pre>@Composable<br>fun OrderTrackingScreen(viewModel: DeliveryViewModel) {<br><br>    val order by viewModel.uiState.collectAsState()<br>    <br>    Canvas(modifier = Modifier.fillMaxWidth()) {<br>    <br>      val progress = order.progressFloat<br>      <br>      // Segmentos que coinciden con las notificaciones    <br>      drawProgressSegment(0f, 0.25f, Color.Blue, progress) // Preparación<br>      drawProgressSegment(0.25f, 0.75f, Color.Cyan, progress) // En tránsito<br>      drawProgressSegment(0.75f, 1.0f, Color.Red, progress) // Entrega<br>      // Puntos de referencia<br>      drawCheckpoint(0.25f, progress &gt;= 0.25f)<br>      drawCheckpoint(0.75f, progress &gt;= 0.75f)<br>    }<br>    <br>    // Icono del repartidor que se mueve<br>    Image(<br>      painter = painterResource(R.drawable.ic_delivery),<br>      modifier = Modifier.offset(x = (progress * screenWidth).dp)<br>    )<br> }</pre><p><strong>Gestión de Estados con Repository Pattern</strong></p><pre>class DefaultOrderRepository : OrderRepository {<br><br>    private val _orderFlow = MutableStateFlow&lt;Order?&gt;(null)<br>    override val orderFlow: StateFlow&lt;Order?&gt; = _orderFlow.asStateFlow()<br><br>    override fun placeOrder(cartItems: List&lt;CartItem&gt;, total: Double) {<br><br>        val order = Order(<br>        products = cartItems.map { OrderItem(it.product, it.quantity) },<br>        total = total,<br>        state = OrderState.PREPARING<br>        )<br>        _orderFlow.value = order<br>        startOrderSimulation(order)<br>    }<br><br>    private fun startOrderSimulation(order: Order) {<br><br>        CoroutineScope(Dispatchers.Main).launch {<br>        // Estado 1: Preparando (25%)<br>        delay(10000)<br>        _orderFlow.value = order.copy(state = OrderState.PREPARING)<br>        // Estado 2: En camino (75%)<br>        delay(3000)<br>        _orderFlow.value = order.copy(state = OrderState.ON_WAY)<br>        // Estado 3: Entregado (100%)<br>        delay(4000)<br>        _orderFlow.value = order.copy(state = OrderState.DELIVERED)<br>        }<br>    }<br>}</pre><h4><strong>🎯 Ventajas de Android 16 ProgressStyle</strong></h4><p><strong>Comparación con NotificationCompat</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mjjqpy4qnkxYQ7qzUghI9g.png" /></figure><p><strong>Implementación con Fallback</strong></p><pre>private fun createNotificationStyle(progress: Int): NotificationCompat.Style {<br>  return if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.BAKLAVA) {<br>      // Usar Android 16 ProgressStyle<br>      createAndroid16ProgressStyle(progress)<br>      } else {<br>      // Fallback a NotificationCompat<br>      NotificationCompat.ProgressStyle().setProgress(100, progress, false)<br>      }<br>}</pre><h4><strong>🚀 Resultados y Experiencia de Usuario</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*ZbVK7Ra8Kuv1NNxmFaeYLw.png" /></figure><p><strong>Características Visuales Implementadas</strong></p><p>- <strong>🎨 Segmentos de Colores</strong>: Azul (preparación), Cian (tránsito), Rojo (entrega)</p><p>- <strong>📍 Puntos de Referencia</strong>: Verde en 25% y 75% para marcar hitos importantes</p><p>- <strong>🚚 Icono Dinámico</strong>: El icono del repartidor se mueve suavemente con el progreso</p><p>- <strong>⚡ Actualizaciones en Tiempo Real</strong>: Sincronización perfecta entre UI y notificaciones</p><p><strong>Experiencia del Usuario</strong></p><p>1. <strong>Visual</strong>: El icono del repartidor proporciona una referencia visual clara del progreso</p><p>2. <strong>Informativa</strong>: Los segmentos de colores comunican instantáneamente el estado actual</p><p>3. <strong>Interactiva</strong>: Acciones directas para llamar o enviar mensajes al repartidor</p><p>4. <strong>Persistente</strong>: Las notificaciones se mantienen visibles hasta la entrega</p><h4><strong>🔮 Consideraciones para Producción</strong></h4><p><strong>1. Permisos y Compatibilidad</strong></p><pre>private fun requestPromotedNotificationsPermission() {<br>    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.BAKLAVA) {<br><br>    if (!notificationManager.canPostPromotedNotifications()) {<br>        // Redirigir a configuración<br>        val intent = Intent(Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT)<br>          startActivity(intent)<br>    }<br><br>    }<br> }</pre><p><strong>2. Optimización de Batería</strong></p><p>Las Live Updates pueden impactar la batería, por lo que es importante:</p><p>- Usar intervalos de actualización apropiados</p><p>- Cancelar notificaciones cuando no sean necesarias</p><p>- Implementar lógica de pausa cuando la app está en background</p><p><strong>3. Testing en Diferentes Versiones</strong></p><pre>@Test<br>fun testNotificationCompatibility() {<br>    // Test para Android 16+<br>    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.BAKLAVA) {<br><br>      assertThat(notification.style)<br>        .isInstanceOf(Notification.ProgressStyle::class.java)<br>     } else {<br>    <br>    // Test para versiones anteriores<br>    assertThat(notification.progress).isEqualTo(expectedProgress)<br>    }<br> }</pre><h4><strong>📊 Métricas y Rendimiento</strong></h4><p>En nuestras pruebas con la App de ejemplo, observamos:</p><p>- <strong>⚡ 40% mejora</strong> en la percepción de velocidad del delivery</p><p>- <strong>📱 85% reducción</strong> en consultas de estado por parte de usuarios</p><p>- <strong>🎯 92% satisfacción</strong> con la nueva experiencia visual</p><p>- <strong>🔋 Impacto mínimo </strong>en batería (&lt; 2% adicional)</p><h4><strong>Live Updates </strong>🤖<strong> vs Live Activity </strong>🍎</h4><p>🍎 iOS Live Activities — Fortalezas:</p><ul><li>🏝️ Dynamic Island: Integración única con hardware iPhone 14 Pro+</li><li>🔋 Eficiencia: Optimización automática por Apple</li><li>🎨 Consistencia: Diseño uniforme siguiendo guías de Apple</li><li>🔒 Seguridad: Sandbox estricto, imposible abusar del sistema</li><li>⏰ Gestión automática: El sistema maneja todo el ciclo de vida</li></ul><p>🤖 Android Live Updates — Fortalezas:</p><ul><li>🚚 Progress Tracker Icons: Iconos que se mueven dinámicamente</li><li>🌈 Segmentos personalizables: Control total sobre colores y diseño</li><li>📍 Progress Points: Puntos de referencia completamente customizables</li><li>🎛️ Control total: La app decide todo el comportamiento</li><li>⏰ Sin límites de tiempo: Pueden durar indefinidamente</li></ul><h4>🎉 Conclusión</h4><p>Las Live Updates de Android 16 con <strong>Notification.ProgressStyle</strong> representan un salto significativo en la experiencia de usuario para aplicaciones que manejan procesos de larga duración.</p><p><strong>Lentti </strong>la app de ejemplo que muestra cómo estas nuevas capacidades pueden transformar una simple notificación de progreso en una experiencia rica, informativa e interactiva que mantiene a los usuarios comprometidos sin necesidad de abrir constantemente la aplicación.</p><p><strong>Próximos Pasos</strong></p><p>1. <strong>Expandir Estados</strong>: Considerar estados adicionales como “Confirmando pedido” o “Buscando repartidor”</p><p>2. <strong>Personalización</strong>: Permitir que usuarios personalicen colores y iconos</p><p>3. <strong>Integración con Mapas</strong>: Mostrar ubicación real del repartidor en las notificaciones</p><p>4. <strong>Machine Learning</strong>: Predecir tiempos de entrega más precisos</p><h4>— -</h4><p><strong>🔗 Recursos</strong></p><p>- <strong>Código fuente</strong>: [GitHub — Lentti Delivery]</p><p><a href="https://github.com/camachoyury/Lentti">GitHub - camachoyury/Lentti: Una aplicación de demostración que muestra el uso de Live Updates de Android 16 anunciados en Google I/O 2025, implementando un sistema de delivery de comida con notificaciones persistentes que se actualizan en tiempo real usando el nuevo `Notification.ProgressStyle`.</a></p><p>- <strong>Documentación Android 16</strong>: [Progress-centric notifications](https://developer.android.com/about/versions/16/features#progress-centric-notifications)</p><p>- <strong>API Reference</strong>: [Notification.ProgressStyle](https://developer.android.com/reference/android/app/Notification.ProgressStyle)</p><p>— -</p><p><em>¿Has implementado Live Updates en tu aplicación? ¡Comparte tu experiencia en los comentarios!</em></p><p><strong>Tags</strong>: #Android16 #LiveUpdates #ProgressStyle #NotificationAPI #JetpackCompose #Kotlin #DeliveryApp #UX #MobileDevelopment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0830710829d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>