public class LocalNotificationHelper
extends java.lang.Object
| Constructor and Description |
|---|
LocalNotificationHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cancel(int notificationId)
Cancels a notification with particular
|
static void |
cancel(LocalNotification notification)
Cancels the given
|
static void |
cancelAll()
Cancels all the scheduled notifications
|
static void |
destroy()
Deprecated.
|
static void |
getAll(LocalNotificationHandler callback)
Returns the list of all
LocalNotifications which
are scheduled and going to trigger in future in |
static java.util.List<LocalNotification> |
getAllSync()
Returns the list of all
LocalNotifications which
are scheduled and going to trigger in future in |
static int |
getDefaultLargeIcon() |
static int |
getDefaultSmallIcon() |
static java.lang.String |
getDefaultTitle() |
static void |
init(android.content.Context context,
java.lang.String defaultTitle,
int defaultIcon)
Deprecated.
|
static void |
init(java.lang.String defaultTitle,
int smallIcon,
int largeIcon)
call this method in 'onCreate' of your Application or Activity class
|
static void |
isScheduled(int notificationId,
LocalNotificationStatusHandler callback)
Returns the status of a notification scheduled on
|
static boolean |
isScheduledSync(int notificationId)
Returns the status of a notification scheduled on
|
static boolean |
schedule(int notificationId,
java.lang.String textContent,
java.util.Date triggerTime)
Schedules a new One-Time local notification and overrides if the
same notification is scheduled with same 'notificationId'
|
static boolean |
schedule(int notificationId,
java.lang.String textContent,
java.util.Date triggerTime,
long repeatDelay)
Schedules a new local notification and overrides if the
same notification is scheduled with same 'notificationId'
|
static boolean |
schedule(int notificationId,
java.lang.String channelId,
int smallIcon,
int largeIcon,
java.lang.String textTitle,
java.lang.String textContent,
long triggerDelay,
long repeatDelay)
Schedules a new local notification and overrides if the
same notification is scheduled with same 'notificationId'
|
static boolean |
schedule(int notificationId,
java.lang.String textContent,
long delay)
Schedules a new One-Time local notification and overrides if the
same notification is scheduled with same 'notificationId'
|
static boolean |
schedule(int notificationId,
java.lang.String textContent,
long delay,
boolean isRepeat)
Deprecated.
|
static boolean |
schedule(int notificationId,
java.lang.String textContent,
long triggerDelay,
long repeatDelay)
Schedules a new local notification and overrides if the
same notification is scheduled with same 'notificationId'
|
static void |
scheduleNotificationJob(LocalNotification notification) |
static void |
setDefaultLargeIcon(int icon) |
static void |
setDefaultSmallIcon(int icon) |
static void |
setDefaultTitle(java.lang.String title) |
@Deprecated
public static void init(android.content.Context context,
java.lang.String defaultTitle,
@DrawableRes
int defaultIcon)
This method is Deprecated as Context is not required for upcoming versions. No need to call init, by default App Name will be used as Notification Title and default drawable will be shown as Notification smallIcon
context - - Application or Activity contextdefaultTitle - - Text you want to show by default on Title of Local NotificationdefaultIcon - - Icon you want to show by default with Local Notificationpublic static java.lang.String getDefaultTitle()
public static void setDefaultTitle(java.lang.String title)
title - - default text for Notifications title. If NULL or BLANK, it will show Application namepublic static int getDefaultSmallIcon()
public static int getDefaultLargeIcon()
public static void setDefaultSmallIcon(int icon)
icon - - default resource for Notifications smallIcon. If -1, it will show 'android.helper.R.drawable.lnh_ic_stat_default'public static void setDefaultLargeIcon(int icon)
icon - - default resource for Notifications largeIcon. If -1, it will show 'android.helper.R.drawable.lnh_ic_stat_default'public static void init(java.lang.String defaultTitle,
@DrawableRes
int smallIcon,
@DrawableRes
int largeIcon)
defaultTitle - - Text you want to show by default on Title of Local NotificationsmallIcon - - Small Icon you want to show by default with Local NotificationlargeIcon - - Large Icon you want to show by default with Local Notification@Deprecated
public static boolean schedule(int notificationId,
java.lang.String textContent,
long delay,
boolean isRepeat)
This method will be removed in up coming version as it does not allow user to specify different values for DELAY and REPEAT Timings
notificationId - - Unique int id of LocalNotificationtextContent - - Body text of your LocalNotificationdelay - - Delay time in millis after which your LocalNotification should be triggeredisRepeat - - True if notification need to be repeated after given delaypublic static boolean schedule(int notificationId,
java.lang.String textContent,
long delay)
notificationId - - Unique int id of LocalNotificationtextContent - - Body text of your LocalNotificationdelay - - Delay time in millis after which your LocalNotification should be triggeredpublic static boolean schedule(int notificationId,
java.lang.String textContent,
long triggerDelay,
long repeatDelay)
notificationId - - Unique int id of LocalNotificationtextContent - - Body text of your LocalNotificationtriggerDelay - - Delay time in millis after which your LocalNotification should be triggeredrepeatDelay - - Repeats after time in millis after which your LocalNotification should be repeatedpublic static boolean schedule(int notificationId,
java.lang.String textContent,
java.util.Date triggerTime)
notificationId - - Unique int id of LocalNotificationtextContent - - Body text of your LocalNotificationtriggerTime - - Time on which your LocalNotification should be triggeredpublic static boolean schedule(int notificationId,
java.lang.String textContent,
java.util.Date triggerTime,
long repeatDelay)
notificationId - - Unique int id of LocalNotificationtextContent - - Body text of your LocalNotificationtriggerTime - - Time on which your LocalNotification should be triggeredrepeatDelay - - Repeats after time in millis after which your LocalNotification should be repeatedpublic static boolean schedule(int notificationId,
java.lang.String channelId,
@DrawableRes
int smallIcon,
@DrawableRes
int largeIcon,
java.lang.String textTitle,
java.lang.String textContent,
long triggerDelay,
long repeatDelay)
notificationId - - Unique int id of LocalNotificationchannelId - - Channel name on which you want to display your LocalNotificationsmallIcon - - Small monochrome png icon drawable you want to show with your LocalNotificationlargeIcon - - Colored icon image drawable you want to show with your LocalNotificationtextTitle - - Title text of your LocalNotificationtextContent - - Body text of your LocalNotificationtriggerDelay - - Delay time in millis after which your LocalNotification should be triggeredrepeatDelay - - Repeats after time in millis after which your LocalNotification should be repeated, must be greater than or equals to 'PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS'public static void getAll(LocalNotificationHandler callback)
LocalNotifications which
are scheduled and going to trigger in future incallback - - object of interface LocalNotificationHandlerpublic static java.util.List<LocalNotification> getAllSync()
LocalNotifications which
are scheduled and going to trigger in future inpublic static void cancel(int notificationId)
notificationId - of LocalNotificationpublic static void cancel(LocalNotification notification)
notification - to cancelpublic static void cancelAll()
public static void isScheduled(int notificationId,
LocalNotificationStatusHandler callback)
notificationId - in acallback - object of interface LocalNotificationStatusHandlerpublic static boolean isScheduledSync(int notificationId)
notificationId - in apublic static void scheduleNotificationJob(LocalNotification notification)
notification - to Schedule. See LocalNotification for more details@Deprecated public static void destroy()