-
public class NotificationHelper
-
-
Field Summary
Fields Modifier and Type Field Description private final StringGROUPLESS_SUMMARY_KEYprivate final IntegerGROUPLESS_SUMMARY_IDpublic final static NotificationHelperINSTANCE
-
Method Summary
Modifier and Type Method Description final Array<StatusBarNotification>getActiveNotifications(Context context)Getter for obtaining all active notifications final BooleanisNotificationActive(Context context, Integer androidNotificationId)Whether this notification is currently posted in the shade. final IntegergetGrouplessNotifsCount(Context context)Iterate over all active notifications and count the groupless ones and return the int count final <ERROR CLASS><StatusBarNotification>getActiveGrouplessNotifications(Context context)Getter for obtaining any groupless notifications A groupless notification is: Not a summary
A null group key or group key using assigned GROUPLESS_SUMMARY_KEY
final BooleanisGroupSummary(StatusBarNotification notif)final Unit)>assignGrouplessNotifications(Context context, <ERROR CLASS><StatusBarNotification> grouplessNotifs)All groupless notifications are assigned the GROUPLESS_SUMMARY_KEY and notify() is called final BooleanareNotificationsEnabled(Context context, String channelId)Determine whether notifications are enabled/disabled either for the entire app or for a specific channel within the application. final NotificationManagergetNotificationManager(Context context)final JSONObjectgetCustomJSONObject(JSONObject jsonObject)final StringgetNotificationIdFromFCMJson(JSONObject fcmJson)final LongArrayparseVibrationPattern(JSONObject fcmBundle)final UrigetSoundUri(Context context, String sound)final StringgetCampaignNameFromNotification(INotification notification)final StringgetGROUPLESS_SUMMARY_KEY()final IntegergetGROUPLESS_SUMMARY_ID()-
-
Method Detail
-
getActiveNotifications
@RequiresApi(api = 23) final Array<StatusBarNotification> getActiveNotifications(Context context)
Getter for obtaining all active notifications
-
isNotificationActive
final Boolean isNotificationActive(Context context, Integer androidNotificationId)
Whether this notification is currently posted in the shade. Below Android M there is no API to ask, so it is assumed to still be posted.
-
getGrouplessNotifsCount
@RequiresApi(api = 23) final Integer getGrouplessNotifsCount(Context context)
Iterate over all active notifications and count the groupless ones and return the int count
-
getActiveGrouplessNotifications
@RequiresApi(api = 23) final <ERROR CLASS><StatusBarNotification> getActiveGrouplessNotifications(Context context)
Getter for obtaining any groupless notifications A groupless notification is:
Not a summary
A null group key or group key using assigned GROUPLESS_SUMMARY_KEY
-
isGroupSummary
final Boolean isGroupSummary(StatusBarNotification notif)
-
assignGrouplessNotifications
@RequiresApi(api = 24) final Unit )>assignGrouplessNotifications(Context context, <ERROR CLASS><StatusBarNotification> grouplessNotifs)
All groupless notifications are assigned the GROUPLESS_SUMMARY_KEY and notify() is called
-
areNotificationsEnabled
final Boolean areNotificationsEnabled(Context context, String channelId)
Determine whether notifications are enabled/disabled either for the entire app or for a specific channel within the application. Note, channels are only applicable beyond API 26.
- Parameters:
context- The app context to check notification enablement against.channelId- The optional channel ID to check enablement for.
-
getNotificationManager
final NotificationManager getNotificationManager(Context context)
-
getCustomJSONObject
final JSONObject getCustomJSONObject(JSONObject jsonObject)
-
getNotificationIdFromFCMJson
final String getNotificationIdFromFCMJson(JSONObject fcmJson)
-
parseVibrationPattern
final LongArray parseVibrationPattern(JSONObject fcmBundle)
-
getSoundUri
final Uri getSoundUri(Context context, String sound)
-
getCampaignNameFromNotification
final String getCampaignNameFromNotification(INotification notification)
-
getGROUPLESS_SUMMARY_KEY
final String getGROUPLESS_SUMMARY_KEY()
-
getGROUPLESS_SUMMARY_ID
final Integer getGROUPLESS_SUMMARY_ID()
-
-
-