Notification.Builder.SetContentIntent(PendingIntent) Method

Definition

Supply a PendingIntent to be sent when the notification is clicked.

[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

Parameters

intent
PendingIntent

PendingIntent

Returns

This Android.App.Notification.Builder instance, allowing calls to be chained.

Attributes

Remarks

Supply a PendingIntent to be sent when the notification is clicked. As of Android Build.VERSION_CODES.S, apps targeting API level Build.VERSION_CODES.S or higher won't be able to start activities while processing broadcast receivers or services in response to notification clicks. To launch an activity in those cases, provide a PendingIntent for the activity itself. As of Build.VERSION_CODES.HONEYCOMB, if this field is unset and you have specified a custom RemoteViews with setContent(RemoteViews), you can use RemoteViews.setOnClickPendingIntent(int,PendingIntent) to assign PendingIntents to individual views in that custom layout (i.e., to create clickable buttons inside the notification view).

See also:

Android reference for android.app.Notification.Builder.setContentIntent.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to