Android class ConnectionService

Can someone just give an example of how to implement this abstract class- ConnectionService.my The 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 feild request and Connection service, how to implement it before that ..

+6
source share
2 answers

This is not for other apps to make calls. To do this, the Intent.ACTION_CALL method is supported, as indicated in another answer.

TelecomManager API , . TelecomManager.placeCall: http://developer.android.com/reference/android/telecom/TelecomManager.html#placeCall

ConnectionService:

API- ConnectionService , VoIP-, VoIP- , . VoIP, API, , , , / , , Android Wear Android Auto.

VoIP-, , , :

1) ConnectionService

2) AndroidManifest.xml

3) PhoneAccount ConnectionService

: http://developer.android.com/reference/android/telecom/ConnectionService.html

, VoIP.

+6

, Intent, , , ACTION_DIAL, - , . , .

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+phnum)); 

phnum - , , editText. , , :

startActivity(callIntent);

Android AndroidManifest.xml

<uses-permission android:name="android.permission.CALL_PHONE" />
-2

Source: https://habr.com/ru/post/1608305/


All Articles