I am working on an application that can manage calls. And the call provider platform is Twilio. But there is an issue when I make an outgoing call using TelecomManager.placeCall()
. It works for the first call after application is started. But when I end this call and try to make another one the previous call stays still alive and I am not able to kill it programmatically. When placeCall()
is called it shows a dialog saying Placing new call will remove your CallApp call..
I read the source code from TelecomManager.java and saw endCall
method which is Deprecated. And documentation does not give any information on how to remove the existing call programmatically.
How can I remove call everytime user hangs up?
After reading the documentation I found a piece of code that I had missed before. Basically the Connection
object returned by ConnectionService.onCreateIncomingConnection
should be destroyed using Connection.destroy
. Otherwise, the call remains in the system alive.