开发者
Commerce And Secrets Without An IAP Tax
Commerce is the easiest feature in this release to misunderstand, so the first sentence has to be blunt: What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com . Commerce does not replace IAP and never will. Purchases still go through Apple, Google, or the payment processor you chose. Codename One does not process the payment, does not touch the money, and does not take a percentage. PR #5300 adds infrastructure around the annoying backend work that comes after a purchase: validation, entitlement checks, subscription lifecycle, webhooks, and reporting. That backend work is real. Anyone who has shipped subscriptions knows the trap. Buying a SKU is not the same as knowing whether the user has the right to a feature right now. Renewals, grace periods, refunds, billing retry, product changes, trials, family sharing and store server notifications all show up later. The device has one view. The store has another. Your backend usually needs a third. Commerce is the optional service that turns that mess into an entitlement. Entitlements Instead Of SKU Branches Your app should not need to know every SKU that grants pro . It should ask for pro . CommerceManager cm = CommerceManager . getInstance (); cm . setAppUserId ( accountId ); if ( cm . isEntitled ( "pro" )) { unlockProFeatures (); } Purchases are still delegated to the existing Purchase API: cm . subscribe ( "pro_monthly" ); // or cm . purchase ( "remove_ads" ); After a purchase, or when the app starts, refresh off the EDT: new Thread (() -> { CommerceManager cm = CommerceManager . getInstance (); cm . refresh (); CN . callSerially (() -> { if ( cm . isEntitled ( "pro" )) { unlockProFeatures (); } }); }). start (); refresh() validates the current receipts with the cloud when the build has a build_key and commerce is enabled. In a local build or simulator, it safely falls back to the normal
AI 资讯
Architecting Location-Based Automation Without Killing the Battery
Opening hook It happened during a quiet afternoon in the library. I was deep in a documentation sprint, and the only sound was the rhythmic tapping of my mechanical keyboard. Suddenly, my phone erupted into a high-pitched, aggressive ringtone that seemed to echo off every wall. Every head in the room turned toward me in unison. My face burned as I scrambled to silence the device, fumbling with the volume buttons while the caller—a telemarketer, of all people—continued to interrupt the silence. It was a humiliating, avoidable moment of pure friction. The problem We live in an age where our phones are supposedly "smart," yet they consistently fail at the most basic context-aware tasks. I found myself constantly needing to switch my phone to silent or vibrate, but the human error component was 100 percent. I would enter a meeting, forget to silence, and pray I didn’t get a call. I would leave a prayer or a lecture, forget to unmute, and then miss urgent calls for the rest of the afternoon. Existing solutions felt heavy-handed. Many automation apps relied on massive, bloated frameworks that kept the CPU awake, draining my battery just to check if I was near a specific building. I didn't want a system that required constant polling or cloud-based synchronization just to realize I was at work or at the gym. I needed something that felt native, lightweight, and, above all, respectful of the hardware's limited power budget. I wanted a way to define boundaries where my phone would simply handle itself, without me having to remember a single toggle. The technical decision / implementation When I started building Muffle, the biggest challenge was the Geofencing API. The temptation is to use LocationManager and track the device's coordinates in real-time, but that’s an immediate death sentence for battery life. Instead, I opted for the GeofencingClient within the Google Play Services library. This is a crucial distinction: LocationManager gives you raw data that you have to pro
AI 资讯
I Got 9.9 Lower TTFT on a Real Android Phone by Reusing llama.cpp KV State
Local LLM inference has an expensive habit: It recomputes prefixes it has already seen. A system prompt. A reused RAG document. A few-shot block. A long static context. If the prefix is identical, why pay the prefill cost again? That's the problem I explored with EdgeSync-LLM. The idea The mechanism is simple: Prompt = shared prefix + new suffix On the first request, EdgeSync prefills the prefix and captures its KV cache state. On the next request sharing that exact prefix, it restores the state and decodes only the new suffix. No llama.cpp fork. No patch. The current validated path uses the public: llama_state_seq_get_data and llama_state_seq_set_data APIs. Measured on a real Android ARM64 phone Model: Qwen2.5-0.5B-Instruct Q4_K_M Shared prefix: 123 tokens 40 requests. 4 threads. Release build. Path Mean TTFT p50 p95 Cold 4828 ms 4752 ms 5297 ms KV state reuse 486 ms 476 ms 569 ms 9.9× lower TTFT on cache hits. The warm path was approximately: 363 ms to decode the 10-token suffix 123 ms to restore the state blob Fragment size: 1.64 MB I also measured the same mechanism on x86-64. Cold mean TTFT: 1395 ms Warm mean TTFT: 185 ms That's 7.5× on cache hits. But I almost published a fake 8.8× speedup This was the most important part of the project. My first implementation directly copied raw K/V tensors. It was fast. Very fast. The benchmark reported an 8.8× speedup. There was one problem. It was wrong. llama.cpp tracks more than the K/V tensor values. Cache cells also have position and sequence metadata used to construct the attention mask. Copying tensor values without restoring that bookkeeping produced an inert fragment. The model skipped prefix computation... ...but attention could not actually see the restored prefix. 14 of 24 cache hits reproduced, token for token, the output of a generation with no prefix at all. The “speedup” was dropped context. So I discarded it. Timing is not enough A broken cache can be fast. That's why EdgeSync now runs two correctness chec
开发者
How to Share Your Location on an iPhone or Android Phone (2026)
Whether it’s through Google Maps or Emergency SOS, there are plenty of ways to quickly let your loved ones know where you are.
开发者
Game Builder Tutorial 2: Build a Blackjack Card Game (Duke Jack)
In Tutorial 1 Duke dashed for coffee with arcade physics. Now he sets the cup down for a calmer contest: Duke Jack , a game of blackjack. A card game has none of that arcade motion — cards sit on the felt and the rules decide who wins. This tutorial shows how the same Game Builder pattern (visual data + an onUpdate companion) handles a card game, where your code reads the cards and runs the table instead of simulating movement. We'll build a felt table, deal a real hand, and wire up the complete blackjack rules: hit, stand, the dealer's draw, and the win/lose decision. What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com . If you haven't set up a project yet, the project setup in Tutorial 1 applies verbatim — only the mode changes (board mode isn't the default, so the -Dmode=board flag is required here): mvn cn1:create-game-scene -DclassName = com.example.dukejack.DukeJack -Dmode = board mvn cn1:gamebuilder Why board mode for cards? Board mode is the Game Builder's grid mode: you place elements on a flat board of cells instead of a free-scrolling world. That's a natural fit for a card table — the felt is a tile layer, and each card is an element you position by hand, carrying its own rank , suit and faceUp data. There's no physics and no camera to chase; the layout is the game state, and your rules read it. (Board mode can also tilt the grid into an isometric view through IsoProjection for tabletop games — for cards we keep it flat and top-down.) Step 1 — A card-table scene Pick New scene → Board . You get a Board (tile) layer for the table surface and a Pieces (entity) layer for the cards. Keeping the felt and the cards on separate layers matters: the felt is static grid data, while the cards are objects your rules deal, flip, and clear. A small grid (here 8×5) is all a card table needs. Step 2 — Lay the felt Select the Board layer,
AI 资讯
Article: Beat-Aligned Mobile Audio Streaming with Virtual Chunks and Native Playback
In this article, I describe the challenges and the design of a React Native real-time mobile beat-aligned playback system for iOS and Android. The system combines personalization with low-latency, and seamless navigation and was the result of careful analysis and experimentation to address strict mobile and network constraints as well as meet user expectations. By Vladyslav Melnychenko
AI 资讯
Google updates Android Bench with new LLMs, but Gemini still lags behind
Android Bench is evolving, and developers can help guide that process.
开发者
Testing In-App Chat and Customer Support Flows in Delivery Apps
The help button is the most important button in your delivery app that your QA team almost never...
开发者
Google's Pixel 11 launch event is set for August 12, with possible price increases
Google's new phones could feature glowing LEDs and higher price tags.
AI 资讯
How I Benchmarked an LLM Running Entirely on a Phone (No Cloud, No API)
"It works on my test input" is the most dangerous sentence in on-device AI development. I typed that sentence - or some version of it - a dozen times while building Redacto, our on-device PII redaction app running Gemma 4 E2B on a Samsung Galaxy S25 Ultra. The model would redact a patient name from a clinical note, I would nod, and I would move on. Then I would hand the phone to a teammate, they would type a police report, and the model would redact the suspect description instead of the victim name. The problem is not the model. The problem is that manual spot-checking is not validation. You are testing a single input against your own expectations, with all the confirmation bias that entails. When you have five domain modes (HIPAA, Financial, Tactical, Journalism, Field Service), three difficulty levels, and two candidate models, you need something systematic. You need a benchmark suite. This post covers how I built one - from dataset curation to scoring methodology to on-device infrastructure - for a hackathon app running entirely on a phone. No cloud. No API calls. No data leaving the device. Why Not Use an Existing Framework? The LLM evaluation space has mature tools. EleutherAI's lm-eval-harness is the community standard for evaluating language models against academic benchmarks like MMLU, HellaSwag, and ARC. Stanford's HELM (Holistic Evaluation of Language Models) provides a multi-metric evaluation framework with standardized scenarios. Google's BIG-bench offers hundreds of tasks for probing specific capabilities. These frameworks are excellent for what they do. They are also completely wrong for this problem, for three reasons. First, they assume server-side inference. lm-eval-harness expects to call a model through an API or load it in PyTorch on a GPU server. Redacto's model runs on a Qualcomm Hexagon NPU inside a phone. There is no Python runtime, no HuggingFace tokenizer at evaluation time, no way to hook into the framework's inference loop. Second, their
AI 资讯
My Fine-Tuned Gemma 4 Loaded Fine, Then Broke on the First Message
I fine-tuned Gemma 4 E2B. The adapter merged cleanly. The export to .litertlm completed without errors. I pushed the model to my phone, initialized the engine, and everything looked green. Then I tried to create a conversation and got this: Failed to apply template: unknown method: map has no method named get (in template:238) No model loading failure. No quantization error. The model initialized, the tokenizer loaded, and then the runtime choked on a Jinja template feature it does not support. This failure only surfaces when you actually try to run inference, not when you load the model. If you are demoing at a hackathon, this is the worst possible time to discover a compatibility issue. I hit this exact bug while building Redacto, a zero-trust PII redaction app that runs Gemma 4 E2B entirely on-device. This post walks through the full fine-tune-to-deploy pipeline: how to QLoRA a model on Colab, export it for LiteRT-LM, and avoid the undocumented template trap that will block your deployment. The Full Pipeline Here is what the fine-tune-to-deploy pipeline looks like end to end: HuggingFace base weights -> QLoRA fine-tune (Colab) -> Merge adapter into base -> Patch chat template <-- the step nobody tells you about -> Quantize + export to .litertlm -> Push to device Each stage has its own failure modes. The template patch step is the one that was undocumented at the time, and it is the one that will cost you hours if you do not know it exists. A note on framing before we dig in: this was an under-resourced fine-tune. I trained on 3,000 of the 400,000 samples in the ai4privacy/pii-masking-400k dataset for a single epoch, and the label format did not fully match what Redacto expected downstream. The point of this post is not the fine-tune's accuracy - it is the deployment mechanics I had to work through to get any fine-tuned model onto the device at all. Step 1: QLoRA Fine-Tuning on Colab QLoRA (Quantized Low-Rank Adaptation) lets you fine-tune a quantized model by tra
AI 资讯
Gson silent bug that Never Said a Word(Interview Prep)
Here's a bug that looks impossible until you understand Gson. You have this data class in your Pokedex app: data class PokemonStat ( @SerializedName ( "base_stat" ) val baseStat : Int , val stat : StatInfo ) A teammate cleans up the code and deletes what looks like a redundant line: data class PokemonStat ( val baseStat : Int , // @SerializedName removed val stat : StatInfo ) It compiles . No red errors. He runs the app — and every Pokemon's baseStat is 0 . Not the real 45 or 49. Just 0 . Everywhere. And Gson never threw an error, never logged a warning, never said a single word. If you can explain why this happens, you understand Gson better than most juniors. This is also a favorite interview question. Let's break it fully. What Gson actually does When the JSON comes back from the server, Gson goes key by key: Read a key from the JSON — say base_stat . Look for a Kotlin property with the exact same name . Found it? Pour the value in. Not found? Leave that property at its default value and move on. That's the entire matching game — exact name match, or nothing. Now look at the "cleaned up" class. The JSON key is base_stat . The Kotlin property is baseStat . Those are not the same string . Gson looks for a property called base_stat , doesn't find one, shrugs, and leaves baseStat at its default. The default for an Int is 0 . That's your bug. @SerializedName("base_stat") was never redundant. It was the sticky note telling Gson: "this property is called baseStat in Kotlin, but look for base_stat in the JSON." Delete the note, and Gson stops matching. Two ways to fix it: Rename the property to base_stat — works, but breaks Kotlin's camelCase convention. Put @SerializedName("base_stat") back — keeps the clean name and matches. This is the right one. But why 0 ? Why not a crash? This is the part that surprised me. A missing field feels like it should be an error. It isn't. Gson treats a missing key as allowed . It builds your object, fills the fields it found, and leaves
AI 资讯
Apple locked hearing assistance inside AirPods. So I built an open-source version for any earbuds.
In 2024, Apple shipped something genuinely great: AirPods Pro can run a clinical-style hearing test and then act as hearing assistance, tuned to your ears. People love it. There's just one catch — it needs an iPhone to set up, recent AirPods to run, and if you're on Android you get nothing. Meanwhile, the average pair of prescription hearing aids costs about $4,700 , and surveys show a $1,500 device is simply out of reach for more than half the people who need one. There are a billion-plus Android phones out there, most of them sitting next to a pair of ordinary earbuds that already contain everything you physically need: a microphone, a DAC, and speakers. The gap seemed absurd. So I've spent the past weeks building OpenHearing — a free, GPLv3 Android app that does the whole pipeline: Hearing check — a pure-tone test using the modified Hughson–Westlake staircase (the same adaptive up-down procedure audiologists use), per ear, per frequency. Or skip it and type in the numbers from a real audiogram. Sound profile — the results are fitted into a per-ear gain curve (half-gain rule for v1; NAL-NL2 is a pluggable strategy for later). Real-time assist — mic in, per-ear DSP, earbuds out. Quiet speech gets louder. Works with whatever earbuds you already own. No root, no special hardware. It is very deliberately not a medical device — no diagnosis, no treatment claims, big disclaimer before anything plays a tone. Think of it as the open, inspectable "gateway" tier below real hearing care. This post is about the three engineering decisions that turned out to matter most. 1. The safety-critical DSP is pure Kotlin — and that's the whole point An app that amplifies sound directly into human ears has exactly one unforgivable failure mode: being loud when it shouldn't be. So the entire signal chain is plain Kotlin with zero Android dependencies, hidden behind a tiny I/O interface. AudioRecord / AudioTrack is a dumb shell; everything that can hurt someone is JVM-testable: input → EQ
AI 资讯
Engineering Geofencing: Lessons in Android Battery and Location Accuracy
It happened during a quiet, solemn moment in a community prayer hall. I was sitting in the third row, reflecting, when suddenly, a high-pitched ringtone shattered the silence. It wasn't my phone, but the ripple effect of embarrassment was immediate. Everyone looked around, shifting uncomfortably. That collective tension is something we have all felt—a moment of human error that technology should have intercepted. I looked at my own device, feeling the familiar anxiety of whether I had remembered to flip the physical silent switch. It was then that I decided to stop relying on my own memory. We live in an era of hyper-connected devices, yet the most basic context-awareness—knowing where we are and how our phone should behave—remains manual. I found myself constantly toggling between 'Normal' and 'Silent' modes at the library, the office, and the gym. If I forgot, I was the person disrupting a meeting. If I remembered to mute it, I inevitably forgot to unmute it, missing urgent calls from family for hours. The existing solutions were either too bloated, requiring invasive cloud permissions, or they simply failed to trigger reliably when the screen was off. I needed a solution that was local, predictable, and battery-conscious. Building Muffle started with the realization that I had to master the GeofencingClient API without draining the user's battery. The primary challenge wasn't just triggering an event; it was doing so while the device was in a deep sleep state. I initially experimented with a standard LocationManager approach, polling GPS coordinates at set intervals. That was a disaster. It kept the radio active, pinged the GPS satellites constantly, and decimated the battery life in under four hours. It was an immediate non-starter for a production-ready application. I pivoted to the Geofencing API provided by Google Play Services, which leverages the fused location provider. This is significantly more efficient because the system handles the batching and hardwa
AI 资讯
iOS and Android Have Different Goals for PWAs: The Real Difference Beyond Support or No Support
This is a reprint from my tips blog. You can find the original article here: [ https://tips.ojapp.app/en/ios-android-pwa-goal-difference-3/ ] Android vs. iPhone: Different Goals for PWAs When people talk about PWAs, the explanation often sounds like this: Android supports PWAs. iPhone does not support PWAs very well. If you only look at the PWA specifications, this explanation is easy to understand. Android Chrome supports manifest.json, Service Worker, installation, notifications, shortcuts, and many other PWA features quite strongly. iPhone Safari, on the other hand, does not behave the same way as Android. But after testing PWAs on both iPhone and Android many times, I started to see the difference in another way. More accurately, Android and iPhone have different goals for PWAs. That is the biggest difference I noticed while testing repeatedly. Android tries to turn web pages into apps Android PWAs are clearly designed in the direction of making web pages feel closer to native apps. The idea is to take a website opened in the browser and move it toward a native-app-like experience. This direction is very strong on Android. That is why many PWA-related features are well supported. manifest.json Service Worker Push notifications Install Prompt Shortcuts theme_color background_color maskable icons display modes orientation Of course, it is not perfect. Manifest cache can be stubborn, multiple PWAs on the same domain can become confusing, and real-device testing can still create plenty of traps. Even so, when you build according to the PWA specification, Android usually responds in a fairly straightforward way. For example, if you set display: fullscreen , the app feels much more full-screen. theme_color is often reflected in the toolbar color. orientation also works quite strongly on Android. In other words, for Android, a PWA is an app made from the Web . iPhone starts from the experience of placing web pages on the home screen iPhone is different. Even before the
AI 资讯
Keeping background services alive: Lessons from building Muffle
Opening hook It happened during a quiet afternoon at the mosque. The imam was mid-sentence when a rhythmic, high-pitched ringtone cut through the silence like a knife. Every head turned. It was my phone. My heart sank as I scrambled to silence it, only to realize I had forgotten to flip the physical toggle before walking in. That moment of collective, disappointed glares burned. It wasn't just an annoyance; it was a total breakdown of my focus and a social failure I had accidentally caused because my phone couldn't manage itself. The problem We live in an era where our devices are supposedly 'smart,' yet they are remarkably bad at knowing when to keep quiet. We carry computers in our pockets that can calculate the exact position of the moon or stream 4K video, but they cannot inherently tell that we are in a meeting, a lecture, or a place of worship. You could argue that setting a manual schedule works, but life isn't static. Meetings run over, prayer times shift by a minute each day based on astronomical calculations, and spontaneous plans happen. I found myself constantly juggling the physical volume buttons. If I remembered to mute it, I inevitably forgot to unmute it afterward, missing urgent calls from family. If I didn't mute it, I was the person disrupting the room. I wanted a solution that respected the context of my location and the specific time of day without requiring me to touch my screen. The core friction is that Android is designed to restrict background processes to save battery, which is exactly what a silent-automation app needs to thrive. Getting the app to reliably trigger a volume change while the phone is sitting in a pocket, deep in Doze mode, became my primary development hurdle. The technical decision / implementation When I started building Muffle, I initially tried a standard Service with a Handler loop to check conditions. It worked fine while the screen was on, but as soon as the phone entered Doze mode, the OS aggressively throttled my
AI 资讯
I built a native Android app in an afternoon, and I've never written a line of Kotlin
I’ve always thought building a mobile app required climbing a massive learning curve just to get a basic environment set up. To test that theory, I tried building my very first Android app using Google AI Studio . Five minutes later, I had a working prototype. The coolest part about this isn't just the speed: it’s that anyone can do this. The traditional barriers to building software are disappearing, making it incredibly easy to just start creating. I recorded the whole 5-minute process here if you want to see what it looks like in practice: What's in the video Prompting AI Studio to build a native Android app from scratch Progressive Webapp (PWA) vs Android Native App in 2026: feature comparison Sideloading the app onto an Android device via USB-C cable. No Play Store required What happens when the AI gets something wrong? Fixing bugs in a vibe coded app
AI 资讯
AnimaStage Lite v1.2.3: Google Play Release, Better Multi-Model Performance & Physics Stability
After several weeks of optimization and community feedback, AnimaStage Lite v1.2.3 is now available. The biggest milestone of this release is that AnimaStage Lite is now available on Google Play, alongside the browser version. 📱 Google Play https://play.google.com/store/apps/details?id=com.webmmd.suite 🌐 Browser https://animastage-lite.app What's new in v1.2.3 📱 Google Play Release AnimaStage Lite is now officially available on Android through Google Play, making it easier to access the editor without manually installing APKs. ⚡ Multi-model performance improvements Working with multiple characters is now much smoother. Improvements include: Performance governor now reacts to the number of visible models. Background characters use a lighter rendering path. When playback is paused, Bullet Physics is simulated only for the selected character. Bullet Physics substeps are capped to improve stability and maintain FPS. 🔄 Physics stability A new Global Physics Stability Registry helps keep simulations more reliable across different scenes. Added: Fix Physics — a soft physics reset that restores the simulation without interrupting the animation timeline. This was implemented after feedback from users who experienced unstable physics when working with multiple models. 🛠 Bug fixes Fixed: SITE_URL is not defined in officialProject.ts General stability improvements Various internal cleanups Project goals AnimaStage Lite is an experimental browser-native MikuMikuDance studio built with WebGL and WASM. Current features include: PMX / PMD support VMD animation playback Bullet Physics Timeline editor MP4 export Browser + Android support The long-term goal is to make MMD creation accessible without requiring a desktop installation. Links 🌐 Website https://animastage-lite.app 📱 Google Play https://play.google.com/store/apps/details?id=com.webmmd.suite 💻 GitHub https://github.com/FBNonaMe/animastage-lite Feedback, bug reports, and feature suggestions are always appreciated. Every relea
AI 资讯
The Future of KMP: Upgrading to Kotlin 2.3.20 and Compose 1.10.3
The Kotlin Multiplatform (KMP) ecosystem moves fast. To stay at the cutting edge, ImagePickerKMP has recently undergone a major architectural upgrade in version 1.0.42 , adopting the latest stable versions of Kotlin and Compose Multiplatform. For the latest requirements and installation guides, always refer to https://imagepickerkmp.dev/ . Major Version Upgrades The v1.0.42 release brings significant updates to the core dependencies of the library: Dependency New Version Previous Version Kotlin 2.3.20 2.1.x Compose Multiplatform 1.10.3 1.9.x Ktor 3.4.1 3.0.x Android Gradle Plugin 8.13.2 8.x Warning: Kotlin 2.3.x brings breaking ABI changes. Projects using Kotlin < 2.3.x will fail to compile with an "ABI version incompatible" error when using ImagePickerKMP 1.0.42. Why the Upgrade Matters Performance: Kotlin 2.3.20 includes numerous compiler optimizations that result in smaller and faster binaries for both Android and iOS. Stability: Compose Multiplatform 1.10.3 resolves several rendering issues on iOS and Desktop, providing a smoother user experience. Future-Proofing: By moving to these versions, ImagePickerKMP is ready for the upcoming features in the Kotlin roadmap. How to Upgrade Your Project To use the latest version of ImagePickerKMP, you must update your build.gradle.kts file: plugins { kotlin ( "multiplatform" ) version "2.3.20" id ( "org.jetbrains.compose" ) version "1.10.3" } dependencies { implementation ( "io.github.ismoy:imagepickerkmp:1.0.42" ) } If your project is not yet ready for Kotlin 2.3.x, you can continue using version 1.0.41 of the library, which maintains compatibility with older Kotlin versions. Conclusion Staying updated is crucial for security, performance, and developer happiness. ImagePickerKMP makes it easy to leverage the power of the latest Kotlin features while maintaining a simple, unified API for media picking. Explore the full API reference and new features at https://imagepickerkmp.dev/ . References [1]: ImagePickerKMP Documentati
开发者
Russian citizens told "switch to Android" after Apple blocks key Russian apps
Russian government lashes out at Apple's "bizarre" decisions.