Proof of concept
Bluetooth MIC Recording
Long-running Bluetooth headset recording on Android
A .NET MAUI proof of concept: multi-hour microphone recording from a Bluetooth headset, kept alive by a foreground service, notification actions, and a battery-optimization exemption.
Abstract
BtRecorderPoc is a MAUI Android proof of concept for long-running headset-mic recording. Recording is controlled from a notification action. A foreground service, wake lock, and battery-optimization exemption keep the pipeline alive for multi-hour sessions.
Problem
Android will kill background recording. Bluetooth SCO routing, notification dismissal, and battery savers make 'press record and walk away' unreliable.
Solution
Start a microphone foreground service at process launch. Show a silent keep-alive notification always, and a control notification only while a BT device is connected.
Architecture
- MainApplication.OnCreate starts BtRecorderService.
- BluetoothStateReceiver shows/hides the control notification on ACL connect/disconnect.
- Notification-only Start/Stop; UI has no record button.
Capabilities
- Notification-only Start/Stop.
- Auto-stop on Bluetooth disconnect.
- Battery-optimization exemption prompt.
- In-app playback with seek.
Audience
MAUI/Android engineers who need headset capture that outlives the activity.
Outcomes
- A documented pattern for microphone foreground services on modern Android.
- Separation of keep-alive versus user control notifications.
- .NET MAUI
- Android
- Bluetooth
- Foreground Service