public class NotifyClient extends NotifyService
NotifyClient
allows to use a notification service running on
another process of the host in order to display notifications, just like if
the service were running on this process.DARK_THEME, LIGHT_THEME, LISTENING_PORT
Constructor and Description |
---|
NotifyClient() |
Modifier and Type | Method and Description |
---|---|
void |
postNotification(java.lang.String title,
java.lang.String message,
java.lang.Integer type,
java.lang.Integer align,
java.lang.Long timeout,
java.lang.String themeName)
Posts a new notification to the service, setting the parameters needed
for it.
|
void |
start()
Starts the service, in case it hasn't been started yet.
|
void |
stop()
Stops the service, in case it's running.
|
protected static NotifyClient |
tryAndGet()
Attempts to create a
NotifyClient object and polls for any
NotifyServer running on this host. |
get, reset
public void start()
NotifyService
start
in class NotifyService
public void postNotification(java.lang.String title, java.lang.String message, java.lang.Integer type, java.lang.Integer align, java.lang.Long timeout, java.lang.String themeName)
NotifyService
postNotification
in class NotifyService
title
- The title to display.message
- The message to display.type
- The notification type (0~7).align
- The text/layout alignment (0,1).timeout
- The maximum time in milliseconds the notification will
stay on screen.themeName
- Either "light" or "dark", refering to the two stock
themes available.NotifyService.DARK_THEME
,
NotifyService.LIGHT_THEME
public void stop()
NotifyService
stop
in class NotifyService
protected static NotifyClient tryAndGet()
NotifyClient
object and polls for any
NotifyServer
running on this host. If the service is located, the
client is kept and returned to the caller.NotifyClient
, able to connect to a local
NotifyServer
running on this host, or null
if no
service could be located.