共用方式為


Connection.SendConnectionEvent(String, Bundle) Method

Definition

Sends an event associated with this Connection with associated event extras to the InCallService.

[Android.Runtime.Register("sendConnectionEvent", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetSendConnectionEvent_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=25)]
public virtual void SendConnectionEvent (string? e, Android.OS.Bundle? extras);
[<Android.Runtime.Register("sendConnectionEvent", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetSendConnectionEvent_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=25)>]
abstract member SendConnectionEvent : string * Android.OS.Bundle -> unit
override this.SendConnectionEvent : string * Android.OS.Bundle -> unit

Parameters

e
String
extras
Bundle

Optional bundle containing extra information associated with the event.

Attributes

Remarks

Sends an event associated with this Connection with associated event extras to the InCallService.

Connection events are used to communicate point in time information from a ConnectionService to a InCallService implementations. An example of a custom connection event includes notifying the UI when a WIFI call has been handed over to LTE, which the InCall UI might use to inform the user that billing charges may apply. The Android Telephony framework will send the #EVENT_CALL_MERGE_FAILED connection event when a call to Call#mergeConference() has failed to complete successfully. A connection event could also be used to trigger UI in the InCallService which prompts the user to make a choice (e.g. whether they want to incur roaming costs for making a call), which is communicated back via Call#sendCallEvent(String, Bundle).

Events are exposed to InCallService implementations via Call.Callback#onConnectionEvent(Call, String, Bundle).

No assumptions should be made as to how an In-Call UI or service will handle these events. The ConnectionService must assume that the In-Call UI could even chose to ignore some events altogether.

Events should be fully qualified (e.g. com.example.event.MY_EVENT) to avoid conflicts between ConnectionService implementations. Further, custom ConnectionService implementations shall not re-purpose events in the android.* namespace, nor shall they define new event types in this namespace. When defining a custom event type, ensure the contents of the extras Bundle is clearly defined. Extra keys for this bundle should be named similar to the event type (e.g. com.example.extra.MY_EXTRA).

When defining events and the associated extras, it is important to keep their behavior consistent when the associated ConnectionService is updated. Support for deprecated events/extras should me maintained to ensure backwards compatibility with older InCallService implementations which were built to support the older behavior.

Java documentation for android.telecom.Connection.sendConnectionEvent(java.lang.String, android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to