Lingua

Connection.OnShowIncomingCallUi Metodo

Definizione

Notifica a questo oggetto Connection che ConnectionService è responsabile della visualizzazione dell'interfaccia utente di chiamata in ingresso per .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
Attributi

Commenti

Notifica a questo oggetto Connection che ConnectionService è responsabile della visualizzazione dell'interfaccia utente di chiamata in ingresso per .Connection

Verrà chiamato solo per le chiamate in ingresso aggiunte tramite un self-managed ConnectionService (vedere PhoneAccount#CAPABILITY_SELF_MANAGED), dove ConnectionService deve mostrare la propria interfaccia utente di chiamata in ingresso.

In caso di chiamate in corso in altri s autogestito ConnectionServiceo in un normale ConnectionService, e non è possibile contenere queste altre chiamate, il framework telecom visualizzerà la propria interfaccia utente di chiamata in ingresso per consentire all'utente di scegliere se rispondere alla nuova chiamata in ingresso e disconnettere altre chiamate in corso o rifiutare la nuova chiamata in ingresso.

È consigliabile attivare la visualizzazione dell'interfaccia utente delle chiamate in ingresso per l'applicazione visualizzando un Notification oggetto con una schermata Intent intera specificata.

Nel codice dell'applicazione è necessario creare un android.app.NotificationChannel oggetto per le notifiche di chiamata in arrivo dall'app:

<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>

Quando si tratta di pubblicare una notifica per la chiamata in arrivo, assicurarsi che usi la chiamata android.app.NotificationChannelin ingresso .

<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>

per android.telecom.Connection.onShowIncomingCallUi().

Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dalla e usati in base ai termini descritti in Creative License 2.5 Attribution License.

Si applica a