Can anyone just give an example how to implement this abstract class- ConnectionService.my idea is to use TelecomManager to make an outgoing call.
https://developer.android.com/reference/android/telecom/ConnectionService.html#SERVICE_INTERFACE
TelecomManager telecomManager = (TelecomManager)this.getSystemService(Context.TELECOM_SERVICE);
PhoneAccountHandle accountHandle=telecomManager.getSimCallManager();
PhoneAccount account=telecomManager.getPhoneAccount(accountHandle);
telecomManager.registerPhoneAccount(account);
CharSequence label=account.getLabel();
ConnectionRequest request = null;
Connection connection= service.onCreateOutgoingConnection(accountHandle,request);
now i need to know what will be given in the request feild and Connection service how to implement before it..
android.telecom.ConnectionService. An abstract service that should be implemented by any apps which either: Can make phone calls (VoIP or otherwise) and want those calls to be integrated into the built-in phone app. Referred to as a system managed ConnectionService .
server. telecom is a code-related android OS service that establishes connections for calls and manages calls. It has multiple functions, including initiating & receiving calls, managing the phone account, providing video profiles, keeping call logs, and working with the InCallUI app to facilitate these functions.
Telephony (/təˈlɛfəni/ tə-LEF-ə-nee) is the field of technology involving the development, application, and deployment of telecommunication services for the purpose of electronic transmission of voice, fax, or data, between distant parties.
android.telecom.Call. Represents an ongoing phone call that the in-call app should present to the user.
It's purpose is not for other apps to place calls. The supported method for doing that is through Intent.ACTION_CALL as stated in the other answer.
There is an API on TelecomManager to place a call, however, that is no different from sending the Intent directly. More information about TelecomManager.placeCall: http://developer.android.com/reference/android/telecom/TelecomManager.html#placeCall
About ConnectionService:
The main purpose of the ConnectionService API is to include third party VoIP calls into the system dialer such that a cellular call and a third-party VoIP call can live side by side and the user can switch between them. VoIP apps that implement this API benefit from this by having their calls treated just like traditional cellular calls including having them show up in the built-in system dialer/in-call UI, the call log, Android Wear support and Android Auto support.
If you were a third party VoIP app that wanted their calls to live side-by-side with traditional cellular calls, then you would:
1) Create an implementation of ConnectionService
2) declare that service within your AndroidManifest.xml file
3) Register a PhoneAccount with your ConnectionService component name
More information: http://developer.android.com/reference/android/telecom/ConnectionService.html
The user is then able to turn on your particular phone account through dialer settings and your connection service is now an option for your user to place and receive phone calls through your own VoIP service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With