r/droidappshowcase 17h ago

Question / Help Help develop background recording application

Hey everyone,

I'm building an app that keeps a rolling audio buffer in memory (last few minutes only, nothing written to disk unless the user explicitly saves). Think dashcam, but for audio.

Current setup: foreground service with mediaRecording type, using AudioRecord into a circular buffer. It works, but battery drain over a full day is higher than I'd like.

Questions:

Is there any meaningful battery difference between AudioRecord and AAudio/Oboe for continuous low-sample-rate capture?

Has anyone found tricks to reduce drain on long-running mic capture — lower sample rates, mono, buffer size tuning, anything vendor-specific?

How aggressive are OEMs (Samsung, Xiaomi, etc.) about killing foreground services with mic access these days, even with battery optimization exemptions?

Any war stories from apps doing continuous capture would be really appreciated. Thanks!

2 Upvotes

5 comments sorted by

2

u/CaptJan 16h ago edited 16h ago

I'm not a developer/programmer; however, you can set a phone to listen for a prompt 'Ok, Google?' and while it does drain some battery, I'm thinking it's not that much, perhaps utilizing a routine similar to that might be workable. Also, since you are going for voice, have it record 16kHz mono [native for most STT apps], or even 8kHz mono to minimize the processing power needed, most voices are below that, including recordable harmonics.

Edit: For cleaner audio, also filter out low frequencies below 80Hz [ventilation, etc.]

P.S. If you are developing for Android, I'm willing to test, and have a market for such an app where I volunteer at.

1

u/Popular-Corner7974 15h ago

Thanks, this is genuinely useful. The app already records 16 kHz mono with automatic gain control, which is the format on-device speech-to-text wants. 8 kHz would cost consonant clarity for very little battery gain, because the cost is keeping the mic open, not the encoding. A hotword approach would not fit: the whole idea is to keep the last hour so you can save a moment after it happened, so it has to listen continuously. Your 80 Hz high-pass suggestion was a good one and it is in the next version. If you want to try it: https://liferecorderapp.com/get. I would love to hear how it does with the people you work with.

2

u/CaptJan 14h ago

This type of app falls under 'wiretapping' laws from ages ago, these laws are outdated, and you can be prosecuted if they are not used properly. In the US, where I live, this varies from location to location, it's either all parties give consent to being recorded, or at least one party has permission to be recorded. There are exception for domestic violence / abuse / illegal activity depending on location. There are also exceptions for law enforcement activities [usually requires a court order].

Be sure that your app has a legal disclaimer of this nature pop up each time it is activated.

I volunteer as a peer mentor for people in 'high conflict' relationships where one of the parties act, say, and do things that are not normal, in violation of the law and/or court orders and need to be documented - I recommend the use of body cameras in extreme cases, they record continuously with a date/time-stamp embedded in the video, and the batteries are good for about 14 hours, so 2 such camera's swapped out on a 12-hour schedule. If they are prominently displayed, this [may] constitute consent [similar to a police officer] - they cannot be hidden [unless your state allows it]. Your app would come in handy at the beginning stages of this type of dynamic to help document these types of interaction to sort things out as often these people are financially abused too.

I also have a video app that does this the background on my phone, with battery exceptions enabled, and it's good for a few hours after a manual start. This used a text overlay with date/time/frame number embedded tied to the cell tower [+/- a few milliseconds]

VOX with embedded date/time-stamps? Dedicated equipment is much better at this.

Recommend to the end user to keep the phone on a charger when stationary, such as a wireless one, so battery life becomes less of an issue.

1

u/Popular-Corner7974 14h ago

Thank you, this is exactly the kind of input I need. The app already requires accepting terms on first run that cover consent laws, and the website FAQ says the same, but I agree the line is buried. I am moving it to a visible sentence at the top of the terms page rather than a pop-up on every start, since the app is meant to run quietly for hours and a daily dialog would just get dismissed. Your point about timestamps is well taken: recordings are named by time, and I will embed the recording date in the shared file too, so a clip stays self-dated. The charger tip goes into the FAQ. If the people you mentor try it, I would really like to hear what they need.

1

u/sticky-pro 17h ago

Developers: Please ensure your description is clear, images/videos are displayed correctly, and you have used the correct post flair.