Android Question How to Keep Audio Playing in Background with a Floating Bubble?

Adamdam

Active Member
Licensed User
Longtime User
Hello,

I am developing a B4A Quran streaming app that plays MP3 files from the Internet.

I want audio playback to continue after the user leaves the app, with a floating bubble (overlay) that stays above other apps and allows Play / Pause / Stop controls or reopening the app.

Requirements:

  • Continuous background audio playback.
  • Floating bubble visible over other apps.
  • Works on modern Android versions.
  • Control playback from the bubble.
What is the best approach in B4A?

  1. Foreground Service
  2. Overlay Window (SYSTEM_ALERT_WINDOW)
  3. Chat Head / Floating Bubble
Does anyone have a complete B4A example that demonstrates:
  • Streaming an MP3 from the Internet
  • Background playback
  • Floating bubble overlay
  • Playback controls from the bubble
Thank you.
 

jkhazraji

Active Member
Licensed User
Longtime User
Create a Service that:
  • Owns the MediaPlayer or ExoPlayer.
  • set AUTOMATIC_FOREGROUND_ALWAYS.
  • Shows a persistent notification.
  • Continues playing when the app is closed.
 
Upvote 0
Top