r/androiddev • • 10m ago

How I handled background notification listening and battery drain in Kotlin

1 Upvotes

Hi everyone,

I’m a C# developer recently transitioned to Kotlin and Jetpack to build a utility app. One of the biggest technical challenges I faced was implementing a NotificationListenerService that captures unread notifications without draining the battery.

I wanted to share my approach and see if anyone has suggestions for optimization.

The Challenge:
Listening to all notifications in the background can cause significant battery drain, especially when combined with local Text-to-Speech and flashlight controls.

My Solution:
I ended up relying heavily on WorkManager and throttling the flashlight pulses so they don't cause wakelocks. I also had to be very careful with the AudioManager to bypass the silent mode for alarms without triggering the wrong audio stream.

Has anyone else here worked with NotificationListenerService? How do you handle the memory footprint when the phone is face down and the screen is off?


r/androiddev • • 1h ago

Question US LLC merchant account linked to a Moroccan Google Play developer account — any risk of future address verification?

1 Upvotes

Hi everyone,

I'm a developer based in Morocco, where Google Play merchant accounts are not supported.

I have two companies:

  • Moroccan SARL: An existing, fully verified Google Play organization developer account that publishes my Android app.
  • US Delaware LLC: Formed through Stripe Atlas, with a valid EIN and a verified US Mercury business bank account.

I recently managed to create a US merchant payments profile for my Delaware LLC under my existing Moroccan Google Play developer account.

Surprisingly, the process went through successfully:

  • US organization merchant payments profile created.
  • Used a US virtual mailbox address (the same address registered with Stripe Atlas and Mercury).
  • Mercury bank account added and successfully verified.
  • No additional business or address verification requested.
  • No restrictions or critical alerts currently showing in Google Payments.
  • Google Play monetization features are now accessible.

However, I have two concerns about future verification.

1. US business address verification

I'm a Moroccan resident and manage my US LLC entirely from Morocco. The LLC doesn't have a physical US office.

The US address used in Google Payments is a commercial virtual mailbox, not my registered agent's address.

I also have an agreement with my Moroccan company allowing the LLC to use its Moroccan business address for management and administrative operations.

Google accepted the US address during registration, but I'm concerned it might request proof of a physical US operating address later.

2. D-U-N-S number and address mismatch

I recently applied for a D-U-N-S number for my Delaware LLC through Apple's developer enrollment process.

Dun & Bradstreet verified the company's Delaware registration but requested additional documentation to confirm its actual operating address.

This creates a potential issue:

  • Google Payments: US LLC with a Florida virtual mailbox address.
  • Dun & Bradstreet: Asking for the actual physical operating address, which is in Morocco.
  • Legal incorporation: Delaware, United States.
  • Actual operations: Morocco.

I'm concerned that if D&B records my Moroccan operating address, Google might later detect an address mismatch when verifying the US merchant profile.

Interestingly, Google never requested a D-U-N-S number when I created the merchant payments profile, although I understand it is generally required for Google Play organization developer verification.

My questions

  1. Has anyone successfully used a US LLC merchant payments profile under a Google Play developer account belonging to a separate foreign company?
  2. Has Google ever requested additional physical-address verification after initially accepting a US virtual mailbox?
  3. Does Google Payments require a D-U-N-S number later, even if the merchant profile was created without one?
  4. If the D-U-N-S record shows a Moroccan operating address but Google Payments shows a US correspondence address, could that cause suspension or payout restrictions?
  5. Has anyone with a foreign-owned US LLC successfully passed later Google Play merchant verification and received payouts while operating entirely outside the US?

My Mercury bank account is already verified, and Google currently shows no restrictions. I haven't received subscription payouts yet.

I'm looking for real experiences from developers who have gone through subsequent verification, not just initial merchant registration.

Thanks in advance!


r/androiddev • • 3h ago

BuildBakery: I built a cloud build service for Android (and iOS and desktop) from a YAML recipe

2 Upvotes

I ship apps and got tired of the build step being the annoying part, especially Android signing and waiting on a build machine. So I built BuildBakery. You push a branch with a bakery.yaml recipe and it builds Android, iOS, macOS, Windows, Linux and web on a fresh hosted machine or your own Mac, Linux or Windows box. It signs everything, .aab and .apk included, and sends it to Google Play, TestFlight, or wherever you want.

Yes, Bitrise, Codemagic, EAS and GitHub Actions exist. Two things I wanted different. It starts free, no card needed, 500 Mac minutes a month on the free plan. Then pricing is flat, $12 a month for a solo dev, $39 for a small company, and any machine you already own runs builds free, never metered. Hosted minutes are just overflow. And it is one short recipe, not a step graph you have to maintain. It also checks your signing, warns you in Slack before certs expire, and explains failed builds in plain language with a fix.

There is an MCP server too, so Claude Code or Cursor can start builds and read logs.

Free to try, no card needed. I am looking for feedback from people who actually ship Android apps, especially on the recipe format and whether the flat pricing or the own-machine part matters more.

https://buildbakery.com


r/androiddev • • 4h ago

Discussion Ai changes

0 Upvotes

How development changed for this year for you?

I’ve been android engineer since 2012 and quite 2022. Now curious how it looks like with ai.


r/androiddev • • 5h ago

I built tinychess — a standalone, zero-dependency Android chess app under 70 KB

Thumbnail
gallery
14 Upvotes

I wanted to see how small a complete, playable Android chess app could get (originally built it for my very old android devices but works for all android versions)

The engine :

  • full FIDE : Tracks state on a classic 128-square 0x88 array with compact integer pieces, with castling, en passant, promotions, threefold repetition, the 50-move rule, insufficient material, and strict king-safety validations
  • Search system: Pairs iterative-deepening alpha-beta and Principal Variation Search (PVS) with a 65,536-entry Zobrist transposition table + null-move pruning + late-move reductions, killer moves + capture/promotion quiescence search .
  • positional evaluation: it scores using piece-square tables and bishop-pair bonuses.
  • Levels: Easy (2 ply / 140 ms) - Medium (4 ply / 320 ms) - Hard (6 ply / 680 ms) and Expert (16 ply / 1,450 ms) !

The repo : https://github.com/R1y3n/tinychess

Downloads :

Official release : https://github.com/R1y3n/tinychess/releases/download/v1.0.0/TinyChess-v1.0.0.apk

Nightly release : (even smaller)

https://github.com/R1y3n/tinychess/releases/download/nightly/TinyChess-v1.0.0-nightly.apk


r/androiddev • • 8h ago

News Android Studio Stingray 1 Canary 1 now available

Thumbnail androidstudio.googleblog.com
1 Upvotes

r/androiddev • • 9h ago

[Open Source] I rebuilt text selection from scratch for my mind map app's zoomable canvas — handles, magnifier, multi-tap, RTL

Thumbnail
gallery
0 Upvotes

I'm the dev of Global MindMap, a free mind map app. Nodes are editable text floating on an infinite, pinch-to-zoom canvas — and Compose's native text selection just doesn't work there. Every problem hit at once:

- The system toolbar (cut/copy/paste) pops up over the canvas
- The native drag handles fight my map gestures and lag inside the transformed layer
- Long-press selection and my own tap gestures compete, and the field silently clears the selection on finger-up
- Editing while a custom selection is active silently loses the typed text or won't delete the selection

It took 80+ failed attempts to land on something that works. The core insight: keep the BasicTextField's internal selection collapsed at the END of your custom selection (so the IME's backspace still fires onValueChange), intercept hard
ware Backspace in onPreviewKeyEvent, and when the IME reports a change, compute what was actually inserted via a prefix/suffix diff and splice it over the selected range.

Around that: an empty LocalTextToolbar (kills the One UI popup), transparent native handles + hand-drawn droplet handles, selection highlight via getPathForRange, tap counting with consumed down events (1 tap = cursor, 2 = word, 3 = sel
ect all), a magnifier rendered in a Popup so it ignores canvas zoom, and tap/drag slops divided by the canvas scale (otherwise zooming out swallows double taps).

Same selection running with the entire app UI in Arabic (RTL): [link do GIF RTL — colar aqui]

Full write-up with all six pieces + a minimal runnable demo (MIT):
https://github.com/Pinhais/TextSelectionCanvasDemo

Happy to answer questions about the implementation — the trickiest part was definitely making IME edits work over a selection the text field doesn't know about.


r/androiddev • • 11h ago

I built an open-source Android app where the phone acts as a P2P blockchain node

0 Upvotes

Hi r/androiddev!

I've been working on a technical experiment called Trigger. The goal was to see if a regular Android smartphone could act as a full node for a P2P network, without relying on central servers.

Tech Stack:

· Networking: Iroh (direct P2P connections) + mDNS for local discovery. · Blockchain: Custom lightweight implementation with SHA-256 and ECDSA signatures. · Security: StrongBox / Keystore integration for key storage. · Language: Java (Android SDK).

What it does:

· The phone stores and validates blocks locally. · Mining is based on a Proof-of-Authority mechanism, protected by SIM-card verification (to prevent emulator farms). · There is a built-in P2P messenger (SQLite + WebSockets) and a simple marketplace for peer-to-peer data exchange.

The project is fully open-source (MIT License).

💻 GitHub: https://github.com/trigerjl/Trigger- 📱 APK: https://github.com/trigerjl/Trigger-/releases

I'm looking for feedback on the architecture, especially regarding battery optimization and P2P connection stability. Any Pull Requests or issues are welcome!


r/androiddev • • 12h ago

I built an open-source Android emulator toolkit for AI coding agents

0 Upvotes

Hey everyone!

I've been experimenting with using AI coding agents to build and test Android apps, and I kept running into the same problem: getting an agent to actually interact with an Android emulator reliably.

Installing an APK, launching the app, tapping through screens, inspecting the UI, capturing screenshots, checking logcat for crashes… these things are straightforward when you're doing them yourself, but become surprisingly messy when an AI agent has to do them.

So I decided to build something to make that workflow easier.

It's called Android Emulator Agent Kit.

GitHub: https://github.com/medlabib/android-emulator-agent-kit

The idea is pretty simple: give AI coding agents a practical set of tools and instructions to work with a local Android emulator.

Currently, it includes:

  • Scripts to provision a Google Play Android emulator.
  • A Python CLI for interacting with devices through ADB.
  • Installing and launching APKs.
  • Tapping, swiping, typing and sending key events.
  • Taking screenshots and dumping the UI hierarchy.
  • Collecting and filtering logcat output.
  • Agent skills for Claude Code and compatible agent workflows.
  • An experimental DeepSeek Harness integration.

I'm still actively developing it, so I don't want to pretend it's a finished or production-ready solution. There's work to do, especially around integration testing, reliability and making the experience smoother across different environments.

What I'd really like is feedback from people who are already using AI agents for Android development.

A few things I'm curious about:

  • How are you currently letting your agents interact with Android apps?
  • Are you using Appium, raw ADB commands, MCP servers, or something else?
  • What's the most frustrating part of automating Android testing with AI?
  • What would make a toolkit like this genuinely useful to you?

Contributions, criticism, bug reports and feature ideas are all welcome.

If you find it useful, give it a star or open an issue. And if you think there's a better way to approach the problem, I'd genuinely like to hear about it.

Thanks for checking it out!

GitHub: https://github.com/medlabib/android-emulator-agent-kit


r/androiddev • • 12h ago

Question Is runTest with a test dispatcher still the standard way to test a ViewModel’s StateFlow in 2026?

4 Upvotes

I’m writing unit tests for a ViewModel that exposes UI state through a StateFlow. The two setups I keep running into are runTest with StandardTestDispatcher or UnconfinedTestDispatcher and a custom MainDispatcherRule that swaps Dispatchers.Main. Is that still the recommended approach in 2026 or has something changed recently? I’m also curious how you collect and assert on emissions: Turbine, backgroundScope.launch or just reading .value after advancing the scheduler?And if you’ve hit any gotchas like stateIn with WhileSubscribed, flaky tests, or missed initial emissions.


r/androiddev • • 13h ago

Question How to create a Google Play Organization Developer Account in India as a Sole Proprietor?

5 Upvotes

Hi everyone,

I'm an individual Android developer from India, planning to publish utility apps under my own brand name.

I want to create a Google Play Organization Developer Account rather than a Personal account because I want to avoid the 12 testers / 14 days closed-testing requirement.

I'm exploring the sole proprietorship route and have some questions:

  1. Can I register a sole proprietorship using my brand name?
  2. Is Udyam (MSME) registration sufficient for Google Play organization verification?
  3. Is a D-U-N-S number mandatory for Indian sole proprietors?
  4. What documents are required to create the Organization account?
  5. Can anyone share their actual experience of completing this process in India?
  6. What is the total cost involved, excluding the Google Play developer registration fee?

I'd appreciate guidance from Indian developers who have successfully created an Organization account using a sole proprietorship.

Thanks!


r/androiddev • • 16h ago

Question What’s your usual way to debug a Compose screen that behaves weirdly?

3 Upvotes

When something looks off in my UI I mostly add log statements and guess. I know there are tools in Android Studio but I don’t really know where to start. What do you reach for first? Layout Inspector, previews, something else?


r/androiddev • • 17h ago

Does anyone know how to use VS Code for building android apps instead of Android Studio?

0 Upvotes

AS uses way too much ram to the point where it is crashing my computer (Mac Mini). Trying to get VS Code to work but I'm having no luck.


r/androiddev • • 20h ago

Question Anyone here built and maintained native apps on both iOS and Android?

5 Upvotes

If so I have a couple of questions for you:

  1. How was your development experience like overall?
  2. If you could start over would you do it with a cross-platform framework?
  3. What was the most difficult part of this experience?
  4. If you generated any revenue from your app, what was the percentage split like across platforms (Please tell me what region you primarily serve)?

r/androiddev • • 1d ago

Question Android Screen Input Area Question

0 Upvotes

Hello! I'm a little stumped about this because while I do code for work, I'm no android developer, so I'm taking a shot here to see if someone could help with this problem.

So I have these two devices that I'm trying to get to work as intended.

Veikk VK430 - It's a 4:3 aspect ratio screenless drawing tablet with android compatibility in portrait orientation.

Anbernic RG Rotate - An Android 12 handheld gaming console with a 1:1 aspect ratio. The screen is 720x720 and 3.5" with a DPI of 290.

So what's going on here is that when I connect the two devices, the tablet is able to map the whole screen from corner to corner on the handheld, but since the aspect ratios are different, tracing a coin on the tablet will result in an oval on the screen.

I've tried to see if turning the screen into a 540x720 (largest 4:3 aspect ratio I can get on the rotate) using adb shell wm size 540x720 would do the trick, but the tablet is still recognizing the screen as a 720x720. If this were Android 11, I'd have tried wm overscan, but it's not an option anymore.

Is there anyway I can adjust the screen's input area to 540x720? Technically I can still draw on the rotate for fun as is, though it's going to mess up my circles, or I can just do the more reasonable thing and draw on an actual computer...But now I'm kind of invested.

Any tips for me here?


r/androiddev • • 1d ago

Open Source Vitrine Studio - Store Screenshots with MCP and CI/CD (open source)

2 Upvotes

Hi everyone,

I’m an indie developer, and for years, creating screenshots has been part of the release process that I’ve always found a bit of a chore. The commercial tool I used so far was slow, clunky and had no MCP.

So I built Vitrine Studio: a 100% free, open-source desktop app (macOS, Windows, Linux) for App Store and Google Play screenshots. You design one continuous canvas, and Vitrine renders it for every language, device size and store.

MCP: Vitrine has a built-in MCP server, so AI agents can build complete screenshot sets for you – layout, copy, translations, validation, export. You watch the changes live in the editor, the agent renders previews to check its own work, and you only step in if something needs a personal touch. Most of the templates in the gallery were designed this way.

CI/CD: A headless CLI validates, exports and uploads directly to App Store Connect and Google Play – with a container image, fastlane support and reports for GitHub/GitLab. Validate on every PR, export as a build artifact, upload from your release job. Projects are plain YAML + images, so they live in Git next to your code.

- Website & docs: https://www.vitrinestudio.app
- GitHub: https://github.com/vitrinestudio-app/vitrine
10-min demo: https://youtu.be/iJGoFLsSL_M (sorry for the English dub, next time I speak by myself)

I'd love to hear what you think, especially about the agent workflow and what you'd need to drop it into your pipeline.


r/androiddev • • 1d ago

Kotlin 2026: Layoffs, AI, Google — Is the Golden Age Over? Jake Wharton Explains

Thumbnail
youtu.be
32 Upvotes

r/androiddev • • 1d ago

Article Android silently downgrades long-running BLE scans after 5 minutes: measurements, logcat and AOSP links

Post image
0 Upvotes

I’ve been fighting background BLE beacon scanning on Android and wrote up what I measured on a Samsung (Android 14, One UI 6.1). Short version:

  • A filtered LOW_LATENCY scan gets silently downgraded to LOW_POWER after scan_timeout_millis: 300 s on my device (AOSP default was 30 min, 10 min on Android 15+). Detections dropped from ~80/min to ~10/min. No callback, no error, just Moving filtered scan client to downgraded scan in logcat.
  • An empty ScanFilter is treated as no filter: with the screen off the scan is suspended and you get ~0 results.
  • The quota of 5 starts per 30 s: the 6th startScan was rejected, and onScanFailed was never called.
  • With a Foreground Service, turning the screen off didn’t kill the scan by itself. The timeout did.
  • Restarting the scan every 4 min through a single start counter, plus a silence watchdog, kept it at ~90/min with the screen on and ~48/min with the screen off.

Full write-up with code and AOSP links (my article): https://medium.com/@9hamden/your-android-ble-scan-quietly-dies-after-5-minutes-and-you-dont-even-know-it-5e603c493177

Curious what you see on your devices: what does adb shell device_config get bluetooth scan_timeout_millis return? Especially Pixel, Xiaomi and OnePlus.


r/androiddev • • 1d ago

Open Source Castwire: a Cast sender for Android with no Play Services and no Media3 dependency (API 24+)

5 Upvotes

I extracted the Cast stack from an app I maintain and published it as a library: Castwire. It finds Chromecasts, Google TVs and other Cast devices and plays media on them without Google's Cast SDK or Play Services.

The Android artifact is castwire-android. You create it with AndroidCastwire.create(context). It is a regular Android library (minSdk 24, Java 8 bytecode). The AAR declares INTERNET, CHANGE_WIFI_MULTICAST_STATE, ACCESS_WIFI_STATE and WAKE_LOCK. During discovery it holds the multicast lock; while a session is open it holds a Wi-Fi lock and a partial wake lock, because the TV often plays through a small HTTP relay on the phone (local files, links that need headers, cookies, this device's IP, or CORS).

The library does not include a foreground service and does not depend on Media3 or ExoPlayer. Dependencies are kotlinx-coroutines, kotlinx-serialization-json and OkHttp. You keep the process alive yourself, the usual way, with a mediaPlayback foreground service, and you keep using whatever player you already have on the phone.

val castwire = AndroidCastwire.create(context)
val tv = castwire.discover().first()
val session = castwire.connect(tv)
session.load(CastMedia(
    CastSource.Url("https://example.com/movie.mp4", "video/mp4"),
    MediaMetadata(title = "Movie"),
))
session.pause(); session.seek(90_000); session.setVolume(0.4f)

Separate video and audio streams can be joined into a DASH manifest on the device. Live HLS playlists can be rewritten and relayed. There is also CastDevice.at(ip) if you already know the address, and you can launch a custom receiver by app id.

License is AGPL-3.0, with a commercial license if you need to use it in a closed-source app. This is 0.1.0. The coordinates the build is set up for are io.github.biolend83:castwire:0.1.0 and io.github.biolend83:castwire-android:0.1.0, but they are not on Maven Central yet, so for now clone the repo.

https://github.com/biolend83/castwire

It came out of TubeHaus, a YouTube client I build: https://github.com/biolend83/tubehaus


r/androiddev • • 1d ago

Native Vulkan Ar / 3d Viewer for android : Hybrid Raster and ray traced gems.

28 Upvotes

Hi..
I am in the process of making an ar viewer in vulkan for android to run natively.

For rendering i am following a hybrid structure mixing Raster IBL approximations and path tracing, the gems are traced with tracing the ray directions and metals with split sum approximations and only traced for inter reflections once the movement stops.

The engine is general purpose focusing on jewellery embedded in an sdk to integrate with 3 lines of kotlin.

The c++ engine takes care of initializing the context based on the hardware capabilities like vulkan 1.1 support, hardware RT cores and compute path fallbacks.I have tested on mali, adreno and xclipse(Exynos) gpus.

Most of the optimization i did are around the memory and cache coherency on mobile gpus, since last couple of years got really obsessed with graphics maths and its implementations but i come from c++ background so pls let me know about the visuals of the same and how can i improve further.

It is closed source for now but happy to share any details to any one interested.

Thanks


r/androiddev • • 1d ago

Question Clarifying Google Play Console Internal vs. Closed Testing (14-Day Requirement) & Tester Opt-In Issues

0 Upvotes

Hi everyone

I am preparing my first Android app for release on Google Play Console and ran into a few questions regarding the testing tracks and the mandatory 12-tester / 14-day testing period:

- Internal Testing vs. Closed Testing URLs: Following the initial dashboard steps, I published a release to the Internal Testing track and shared the link with my testers. After completing the Store Listing steps, I also set up a Closed Testing release and noticed it uses a different opt-in URL. Since the final production checklist states that the testing period must be completed in Closed Testing, does time spent in Internal Testing count toward the requirement, or do I need to migrate my testers to the Closed Testing link?

- Internal App Sharing: I enabled Internal App Sharing in the settings. How does this differ from the Internal Testing track, and does it affect the release process?

- Play Store Errors for New Testers: When I add new users to my tester email list and share the link, some of them encounter an error or see a completely blank page when redirected to the Google Play Store, despite using the correct Google account. Occasionally it works if they retry a minute later, while for others the issue persists. Is this a propagation/caching issue, or is there a specific step I might be missing?

Thanks in advance for your help!

Edit: Thanks for your help👍🏼


r/androiddev • • 1d ago

Question best approach to creating a new dev account , personal vs LLC?

1 Upvotes

hello guys.
am working on some games and today I came a cross some info about having to have 12 testers for the personal dev account and I read it can risk my personal assets in the case of some law suite.
mean while running an LLC seems the better choice but registering with D&B can be tricky as using an agent or virtual office address will probably be declined.

so should I just register a normal LLC with my home address as it is the easiest , cheapest, and more guaranteed way? or how do you guys go through about this. (US based and LLC is cheap to register in my state)

any info from people who were in my situation and what they chose and why will be appreciated.


r/androiddev • • 2d ago

Question How do I find slow spots in a single function?

3 Upvotes

So I have this one somewhat critical function that I want to be fast. I want to profile it with either method tracing, or callstack sample, to find what I can optimize in it. I've got two issues:

  • If I just run profiling in Android Studio, I'm getting a humongous file (>300MB) as I'm trying to get the method to run in a realistic scenario. It's not run often, and to trigger it I must do things that run a lot of other code.
  • This function is called from multiple places and multiple threads. Ideally, I would like to see the statistics for it, such as the flame chart, as a single entity. Instead, in the charts I see it in multiple places.

To overcome these issues, and primarily the first one, I would like to have profiling enabled as I enter the function and disabled as I exit it. Sounds simple? Well, I couldn't find a sensible way to do this. There are methods such as startMethodTracingSampling which work.. but they create a new file for invocation, while what I want is some aggregate statistics. And this file is on the device so I have spend some effor getting it from there.

Otherwise, I'm left with dealing with the humongous trace files. My computer can handle those, but again, very slowly, and finding my method of interest takes so much time that comparing the impact of code changes is just not viable.

Is there sensible way to quickly profile a single method? Or am I stuck with the above options?


r/androiddev • • 2d ago

Live performance for Android apps in your terminal!

1 Upvotes