android-components / mozilla.components.feature.webnotifications / WebNotificationFeature

WebNotificationFeature

class WebNotificationFeature : WebNotificationDelegate (source)

Feature implementation for configuring and displaying web notifications to the user.

Initialize this feature globally once on app start

WebNotificationFeature(
    applicationContext, engine, icons, R.mipmap.ic_launcher, BrowserActivity::class.java
)

Parameters

context - The application Context.

engine - The browser engine.

browserIcons - The entry point for loading the large icon for the notification.

smallIcon - The small icon for the notification.

activityClass - The Activity that the notification will launch if user taps on it

Constructors

Name Summary
<init> WebNotificationFeature(context: <ERROR CLASS>, engine: Engine, browserIcons: BrowserIcons, smallIcon: Int, activityClass: Class<out <ERROR CLASS>>?)
Feature implementation for configuring and displaying web notifications to the user.

Functions

Name Summary
onCloseNotification fun onCloseNotification(webNotification: WebNotification): Unit
Invoked when a web notification is to be closed.
onShowNotification fun onShowNotification(webNotification: WebNotification): Unit
Invoked when a web notification is to be shown.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.