mazen amr
mazen amr

Reputation: 370

Microphone is not worked when app in background and screen is locked (only after i call setActive())

I have a voip app where i use the telecom API powered by android to receive calls , when i answer the call i do the following

@Override
  public void onAnswer() {
  super.onAnswer();
  startForeground(SERVICE_TYPE_MICROPHONE,notification,ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
  startForeground(200, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL);
  setActive();  // the problematic function 
// the rest of logic to answer the call

  } 

To summarize , i use class that extend ConnectionService and use onAnswer inside the connection. My problem is that when i receive a call where app in background and screen is locked while setActive() is being called , the mic is not accessible or working , but if i comment out setActive() , the mic is working perfectly but then the logic of answer the call from telecom api break and get me in an infinite loop where i need to answer multiple time

Upvotes: 0

Views: 479

Answers (0)

Related Questions