Home > other >  How to use ConnectionService obtain call UI presentation
How to use ConnectionService obtain call UI presentation

Time:09-15

I am trying to use the ConnectionService from FCM present ConnectionService provide call UI in the notice. I want to do this? According to the steps of https://developer.android.com/guide/topics/connectivity/telecom/selfManaged, I added:


And

Android: label="@ string/connection_service_label"
Android: permission="android. Permission. BIND_TELECOM_CONNECTION_SERVICE" & gt;




When I received a notice from the FCM, I'll:

TelecomManager TelecomManager=(TelecomManager) enclosing getSystemService (Context. TELECOM_SERVICE);
String packageName=getApplicationContext (.) getPackageName ();
String className=SparrowConnectionService. Class. GetName ();
The ComponentName the ComponentName=new the ComponentName (packageName, className);
PhoneAccountHandle accountHandle=new PhoneAccountHandle (the componentName, "testID");

PhoneAccount account=PhoneAccount. Builder (accountHandle, getApplicationContext () get string (R.s tring. Connection_service_label))
SetCapabilities (PhoneAccount. CAPABILITY_SELF_MANAGED)
.build();
TelecomManager. RegisterPhoneAccount (account);

Bundle extras=new Bundle ();
Extras. PutParcelable (TelecomManager EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);
Extras. PutInt (TelecomManager EXTRA_START_CALL_WITH_VIDEO_STATE, VideoProfile STATE_BIDIRECTIONAL);
TelecomManager. AddNewIncomingCall (accountHandle, extras);

Which triggered the success of my ConnectService onCreateIncomingConnection method (CallConnection extends the Connection)

@ Override
Public Connection onCreateIncomingConnection (PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request) {
The d (TAG, "onCreateIncomingConnection");
CallConnection connection=new CallConnection (getApplicationContext ());
Connection. SetConnectionProperties (connection. PROPERTY_SELF_MANAGED);
Connection. SetCallerDisplayName (" TestID, "TelecomManager. PRESENTATION_ALLOWED);

Bundle extras=new Bundle ();
Extras. PutBoolean (Connection. EXTRA_ANSWERING_DROPS_FG_CALL, true);
Extras. PutString (Connection. EXTRA_CALL_SUBJECT, "Test call subject text");
Connection. PutExtras (extras);
Return the connection;
}

It would call my CallConnection onShowIncomingCallUi method, but does not display any UI. How to display the UI?

CodePudding user response:

You need to you calling UI shown in onShowIncomingCallUi method. The self-management ConnectionService API is intended for the call to provide their complete application for call UI, but still want to coexist with the Android mobile calls.

CodePudding user response:

The building Lord, how are you, do you have the complete process, or a demo? Not very understand your ConnectionService logic
  • Related