Language

Notification.WearableExtender.SetDisplayIntent(PendingIntent) メソッド

定義

このメソッドは、API レベル 29 では非推奨になりました。

[Android.Runtime.Register("setDisplayIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$WearableExtender;", "")]
public Android.App.Notification.WearableExtender? SetDisplayIntent(Android.App.PendingIntent? intent);
[<Android.Runtime.Register("setDisplayIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$WearableExtender;", "")>]
member this.SetDisplayIntent : Android.App.PendingIntent -> Android.App.Notification.WearableExtender

パラメーター

intent
PendingIntent

PendingIntent: アクティビティの PendingIntent

戻り値

メソッドチェーン用のこのオブジェクト

属性

注釈

このメソッドは、API レベル 29 では非推奨になりました。 表示意図はサポートされなくなりました。

この通知を表示するときにアクティビティ ビュー内で起動する意図を設定します。 指定された PendingIntent は、アクティビティ用である必要があります。

Intent displayIntent = new Intent(context, MyDisplayActivity.class);
PendingIntent displayPendingIntent = PendingIntent.getActivity(context,
        0, displayIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
Notification notif = new Notification.Builder(context, CHANNEL_ID)
        .extend(new Notification.WearableExtender()
                .setDisplayIntent(displayPendingIntent)
                .setCustomSizePreset(Notification.WearableExtender.SIZE_MEDIUM))
        .build();

起動するアクティビティは、埋め込みを許可し、エクスポートする必要があり、空のタスク アフィニティを持っている必要があります。 デバイスの既定のライト テーマを使用することもお勧めします。

AndroidManifest.xml エントリの例:

<activity android:name="com.example.MyDisplayActivity"
    android:exported="true"
    android:allowEmbedded="true"
    android:taskAffinity=""
    android:theme="@android:style/Theme.DeviceDefault.Light" />

android.app.Notification.WearableExtender.setDisplayIntentの Android リファレンス。

このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。

適用対象