- All Known Implementing Classes:
ExternalMain, Main
public interface NotificationService
A service to send messages to users. This service is currently provided by desktopgui (when supported and enabled). Other applications may support this interface in the future.
Example usage:
ClientAppManager cmgr = _context.clientAppManager();
if (cmgr != null) {
NotificationService ns = (NotificationService) cmgr.getRegisteredApp("desktopgui");
if (ns != null)
ns.notify("foo", null, Log.INFO, _t("foo"), _t("message"), "/foo/bar");
}
Method Summary
All MethodsModifier and TypeMethodDescriptionbooleancancel(int id) Cancel a notification if possible.intSend a (possibly delayed) notification to the user.booleanUpdate the text of a notification if possible.
Method Details
notify
Send a (possibly delayed) notification to the user.- Parameters:
source- e.g. "i2psnark"category- may be null, probably unusedpriority- higher is higher, Log.INFO etc. recommended, probably unusedtitle- for the popup, translatedmessage- body text of the notification, translatedpath- in console for more information, starting with /, must be URL-escaped, or null- Returns:
- an ID to use with
cancel(int)or update(), or -1 on failure
cancel
boolean cancel(int id) Cancel a notification if possible.- Parameters:
id- as received fromnotify(String, String, int, String, String, String)- Returns:
- true if the notification was cancelled
update
Update the text of a notification if possible.- Parameters:
id- as received from notify()title- for the popup, translatedmessage- body text of the notification, translatedpath- in console starting with /, must be URL-escaped, or null- Returns:
- true if the notification was updated