语言

Notification.Builder.SetContentIntent(PendingIntent) 方法

定义

提供在单击通知时要发送的 PendingIntent。

[Android.Runtime.Register("setContentIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetSetContentIntent_Landroid_app_PendingIntent_Handler")]
public virtual Android.App.Notification.Builder SetContentIntent(Android.App.PendingIntent? intent);
[<Android.Runtime.Register("setContentIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetSetContentIntent_Landroid_app_PendingIntent_Handler")>]
abstract member SetContentIntent : Android.App.PendingIntent -> Android.App.Notification.Builder
override this.SetContentIntent : Android.App.PendingIntent -> Android.App.Notification.Builder

参数

intent
PendingIntent

PendingIntent

返回

此 Android.App.Notification.Builder 实例允许链接调用。

特性

注解

提供在单击通知时要发送的 PendingIntent。 从 Android Build.VERSION_CODES起。S,面向 API 级别的应用Build.VERSION_CODES。S 或更高版本无法在处理广播接收器或服务以响应通知单击时启动活动。 若要在这些情况下启动活动,请为活动本身提供 PendingIntent。 截至Build.VERSION_CODES。HONEYCOMB,如果此字段未设置,并且你已指定了具有 setContent(RemoteViews)的自定义 RemoteViews,则可以使用 RemoteViews.setOnClickPendingIntent(int,PendingIntent) 将 PendingIntents 分配给该自定义布局中的单个视图(即,若要在通知视图中创建可单击的按钮)。

Android 参考。android.app.Notification.Builder.setContentIntent

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

另请参阅