Connection.OnShowIncomingCallUi メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
このConnectionに、ConnectionServiceの着信呼び出しユーザー インターフェイスを表示する役割を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
- 属性
注釈
このConnectionに、ConnectionServiceの着信呼び出しユーザー インターフェイスを表示する役割をConnectionが担っていることを通知します。
自己管理型の ConnectionService ( PhoneAccount#CAPABILITY_SELF_MANAGEDを参照) を介して追加された着信呼び出しに対してのみ呼び出されます。この場合、 ConnectionService は独自の着信呼び出しユーザー インターフェイスを表示する必要があります。
他の自己管理 ConnectionServiceや通常の ConnectionServiceで通話が継続していて、これらの他の通話を保持できない場合、Telecom フレームワークは独自の着信通話ユーザー インターフェイスを表示して、ユーザーが新しい着信通話に応答して他の進行中の通話を切断するか、または新しい着信通話を拒否するかを選択できるようにします。
全画面表示のNotificationが指定されたIntentを表示して、アプリケーションの着信呼び出しユーザー インターフェイスの表示をトリガーする必要があります。
アプリケーション コードでは、アプリからの着信通話通知の android.app.NotificationChannel を作成する必要があります。
<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>
着信通話の通知を送信するときは、着信通話 android.app.NotificationChannelを使用していることを確認します。
<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>
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。