Connection.OnShowIncomingCallUi Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Notifica que Connection es ConnectionService responsable de mostrar su interfaz de usuario de llamada entrante para .Connection
[Android.Runtime.Register("onShowIncomingCallUi", "()V", "GetOnShowIncomingCallUiHandler", ApiSince=26)]
public virtual void OnShowIncomingCallUi();
[<Android.Runtime.Register("onShowIncomingCallUi", "()V", "GetOnShowIncomingCallUiHandler", ApiSince=26)>]
abstract member OnShowIncomingCallUi : unit -> unit
override this.OnShowIncomingCallUi : unit -> unit
- Atributos
Comentarios
Notifica que Connection es ConnectionService responsable de mostrar su interfaz de usuario de llamada entrante para .Connection
Solo se llamará para las llamadas entrantes agregadas a través de un autoadministrado ConnectionService (consulte PhoneAccount#CAPABILITY_SELF_MANAGED), donde ConnectionService debe mostrar su propia interfaz de usuario de llamada entrante.
Si hay llamadas en curso en otros s autoadministrados ConnectionService, o en una normal ConnectionService, y no es posible mantener estas otras llamadas, el marco telecom mostrará su propia interfaz de usuario de llamada entrante para permitir al usuario elegir si responder a la nueva llamada entrante y desconectar otras llamadas en curso, o para rechazar la nueva llamada entrante.
Debe desencadenar la presentación de la interfaz de usuario de llamada entrante para la aplicación mostrando un Notification con una pantalla Intent completa especificada.
En el código de la aplicación, debe crear un para android.app.NotificationChannel las notificaciones de llamadas entrantes desde la aplicación:
<code>
NotificationChannel channel = new NotificationChannel(YOUR_CHANNEL_ID, "Incoming Calls",
NotificationManager.IMPORTANCE_MAX);
// other channel setup stuff goes here.
// We'll use the default system ringtone for our incoming call notification channel. You can
// use your own audio resource here.
Uri ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
channel.setSound(ringtoneUri, new AudioAttributes.Builder()
// Setting the AudioAttributes is important as it identifies the purpose of your
// notification sound.
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build());
NotificationManager mgr = getSystemService(NotificationManager.class);
mgr.createNotificationChannel(channel);
</code>
Cuando llegue el momento de publicar una notificación para la llamada entrante, asegúrese de que usa la llamada android.app.NotificationChannelentrante.
<code>
// Create an intent which triggers your fullscreen incoming call user interface.
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClass(context, YourIncomingCallActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_MUTABLE_UNAUDITED);
// Build the notification as an ongoing high priority item; this ensures it will show as
// a heads up notification which slides down over top of the current content.
final Notification.Builder builder = new Notification.Builder(context);
builder.setOngoing(true);
builder.setPriority(Notification.PRIORITY_HIGH);
// Set notification content intent to take user to fullscreen UI if user taps on the
// notification body.
builder.setContentIntent(pendingIntent);
// Set full screen intent to trigger display of the fullscreen UI when the notification
// manager deems it appropriate.
builder.setFullScreenIntent(pendingIntent, true);
// Setup notification content.
builder.setSmallIcon( yourIconResourceId );
builder.setContentTitle("Your notification title");
builder.setContentText("Your notification content.");
// Set notification as insistent to cause your ringtone to loop.
Notification notification = builder.build();
notification.flags |= Notification.FLAG_INSISTENT;
// Use builder.addAction(..) to add buttons to answer or reject the call.
NotificationManager notificationManager = mContext.getSystemService(
NotificationManager.class);
notificationManager.notify(YOUR_CHANNEL_ID, YOUR_TAG, YOUR_ID, notification);
</code>
Java documentación para android.telecom.Connection.onShowIncomingCallUi().
Las partes de esta página son modificaciones basadas en el trabajo creado y compartido por el Android y se usan según los términos descritos en creative Creative Commons 2.5 Attribution License.