Azure Communication Service ACS for android App

mithil kumar 0 Reputation points
2025-03-05T10:16:48.45+00:00

Hi Team,

I am trying to build a application to use ACS for incoming call using notification hub, call comes and working fine during our app is open, but once I close my app or app goes to background, microphone seems muted but can able to here second side voice.
I am trying to integrate ACS with android SDK's provided Telecom manager + connection service, same issues also I faced, one side call muted.
Can give some sample how to make call active even in background and if ACS use phone build in UI , how to manage this.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,032 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 3,520 Reputation points Microsoft External Staff
    2025-03-05T13:26:41.9033333+00:00

    Hi @mithil kumar
    Thanks for reaching out to Microsoft Q&A.
    The microphone issue when the app goes into the background with Azure Communication Services (ACS) on Android. This happens often because of Android's background execution limits, which can restrict mic access.
    Android limits background access to the microphone. A Foreground Service ensures continuous audio capture during calls.

    Declare Foreground Service in AndroidManifest.xml,

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <service
        android:name=".CallForegroundService"
        android:foregroundServiceType="microphone|mediaProjection"
        android:exported="false"/>
    

    Create the Foreground Service (CallForegroundService.kt),

    class CallForegroundService : Service() {
        override fun onCreate() {
            super.onCreate()
            startForegroundService()
        }
        private fun startForegroundService() {
            val notification = NotificationCompat.Builder(this, "CALL_CHANNEL_ID")
                .setContentTitle("Call in Progress")
                .setContentText("Your call is active")
                .setSmallIcon(R.drawable.ic_call)
                .setOngoing(true)
                .setPriority(NotificationCompat.PRIORITY_HIGH)
                .build()
            startForeground(1, notification)
        }
        override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
            return START_STICKY
        }
        override fun onBind(intent: Intent?): IBinder? {
            return null
        }
        override fun onDestroy() {
            super.onDestroy()
        }
    }
    

    Start the Foreground Service Before Accepting a Call,

    val serviceIntent = Intent(this, CallForegroundService::class.java)
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        startForegroundService(serviceIntent)
    } else {
        startService(serviceIntent)
    }
    

    ref: Known Issues with ACS
    Best Practices for ACS
    Troubleshooting Microphone Issues
    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.
    Please let us know if you need further assistance.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.