Package org.mozilla.geckoview
Class WebNotification
Object
org.mozilla.geckoview.WebNotification
- All Implemented Interfaces:
Parcelable
This class represents a single Web Notification. These
can be received by connecting a
WebNotificationDelegate
to GeckoRuntime
via
GeckoRuntime.setWebNotificationDelegate(WebNotificationDelegate)
.-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Parcelable.Creator<WebNotification>
final String
ImageURL contains the URL of an icon to be displayed as part of the notification.final String
Lang indicates the notification's language, as specified using a DOMString representing a BCP 47 language tag.final boolean
indicates whether the notification came from private browsing mode or not.final boolean
RequireInteraction indicates whether a notification should remain active until the user clicks or dismisses it, rather than closing automatically.final boolean
When set, indicates that no sounds or vibrations should be made.final String
This is the URL of the page or Service Worker that generated the notification.final String
Tag is the ID of the notification.final String
Text represents the body of the notification.final String
TextDirection indicates the direction that the language of the text is displayed.final String
Title is shown at the top of the notification window.final int[]
A vibration pattern to run with the display of the notification.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
click()
This should be called when the user taps or clicks a notification.int
void
dismiss()
This should be called when the app stops showing the notification.void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
title
Title is shown at the top of the notification window.- See Also:
-
tag
Tag is the ID of the notification.- See Also:
-
text
Text represents the body of the notification.- See Also:
-
imageUrl
ImageURL contains the URL of an icon to be displayed as part of the notification.- See Also:
-
textDirection
TextDirection indicates the direction that the language of the text is displayed. Possible values are: auto: adopts the browser's language setting behaviour (the default.) ltr: left to right. rtl: right to left.- See Also:
-
lang
Lang indicates the notification's language, as specified using a DOMString representing a BCP 47 language tag.- See Also:
-
requireInteraction
@NonNull public final boolean requireInteractionRequireInteraction indicates whether a notification should remain active until the user clicks or dismisses it, rather than closing automatically.- See Also:
-
source
This is the URL of the page or Service Worker that generated the notification. Null if this notification was not generated by a Web Page (e.g. from an Extension).TODO: make NonNull once we have Bug 1589693
-
silent
public final boolean silentWhen set, indicates that no sounds or vibrations should be made.- See Also:
-
privateBrowsing
public final boolean privateBrowsingindicates whether the notification came from private browsing mode or not. -
vibrate
@NonNull public final int[] vibrateA vibration pattern to run with the display of the notification. A vibration pattern can be an array with as few as one member. The values are times in milliseconds where the even indices (0, 2, 4, etc.) indicate how long to vibrate and the odd indices indicate how long to pause. For example, [300, 100, 400] would vibrate 300ms, pause 100ms, then vibrate 400ms.- See Also:
-
CREATOR
-
-
Method Details
-
click
@UiThread public void click()This should be called when the user taps or clicks a notification. Note that this does not automatically dismiss the notification as far as Web Content is concerned. For that, seedismiss()
. -
dismiss
@UiThread public void dismiss()This should be called when the app stops showing the notification. This is important, as there may be a limit to the number of active notifications each site can display. -
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-