Class AN_NotificationCompat.Builder
Builder class for AN_Notification objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts. On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect. For example, action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later.
Inheritance
Inherited Members
Namespace: SA.Android.App
Assembly: cs.temp.dll.dll
Syntax
public class Builder
Properties
ChanelId
Notification channel id
Declaration
public string ChanelId { get; }
Property Value
Type | Description |
---|---|
System.String |
Defaults
Notification Defaults. Like DEFAULT_ALL
Declaration
public int Defaults { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SoundName
Notification sounds name Note that if objcet was receiveed from nativ part, in case youu have prodvided a valid sound before. This filed will have native url to the sound.
Declaration
public string SoundName { get; }
Property Value
Type | Description |
---|---|
System.String |
Text
Notification body text.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
System.String |
Title
Notification body title.
Declaration
public string Title { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Build()
Combine all of the options that have been set and return a new AN_Notification object.
Declaration
public AN_Notification Build()
Returns
Type | Description |
---|---|
AN_Notification | The build. |
SetBadgeIconType(Int32)
Sets which icon to display as a badge for this notification. Must be one of BADGE_ICON_NONE, BADGE_ICON_SMALL, BADGE_ICON_LARGE. Note: This value might be ignored, for launchers that don't support badge icons.
Declaration
public void SetBadgeIconType(int icon)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | icon | icon type. |
SetChanelId(String)
Specifies the channel the notification should be delivered on.
Declaration
public void SetChanelId(string chanelId)
Parameters
Type | Name | Description |
---|---|---|
System.String | chanelId | Id of the notifications chanel |
SetContentText(String)
Set the second line of text in the platform notification template.
Declaration
public void SetContentText(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Content Text. |
SetContentTitle(String)
Set the first line of text in the platform notification template.
Declaration
public void SetContentTitle(string title)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | Title. |
SetDefaults(Int32)
Set the default notification options that will be used. The value should be one or more of the following fields combined with bitwise-or: DEFAULT_SOUND, DEFAULT_VIBRATE, DEFAULT_LIGHTS
For all default values, use DEFAULT_ALL.
Declaration
public void SetDefaults(int defaults)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | defaults | default value |
SetLargeIcon(Texture2D)
Add a large icon to the notification content view. In the platform template, this image will be shown on the left of the notification view in place of the small icon (which will be placed in a small badge atop the large icon).
Declaration
public void SetLargeIcon(Texture2D icon)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | icon | Icon as Texture2D |
SetNumber(Int32)
Set the large number at the right-hand side of the notification. This is equivalent to setContentInfo, although it might show the number in a different font size for readability.
Declaration
public void SetNumber(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | notification badges number. |
SetSmallIcon(String)
Set the small icon resource, which will be used to represent the notification in the status bar. The platform template for the expanded view will draw this icon in the left, unless a large icon has also been specified, in which case the small icon will be moved to the right-hand side.
Do not specify file extension. Example: myIcon
Declaration
public void SetSmallIcon(string iconName)
Parameters
Type | Name | Description |
---|---|---|
System.String | iconName | A android resource name in the application's package of the drawable to use. |
SetSound(String)
Set the sound to play. It will play on the default stream. On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.
Declaration
public void SetSound(string soundName)
Parameters
Type | Name | Description |
---|---|---|
System.String | soundName | sound name |
SetStyle(AN_NotificationCompat.Style)
Add a rich notification style to be applied at build time. If the platform does not provide rich notification styles, this method has no effect.The user will always see the normal notification style.
Declaration
public void SetStyle(AN_NotificationCompat.Style style)
Parameters
Type | Name | Description |
---|---|---|
AN_NotificationCompat.Style | style | Object responsible for modifying the notification style. |