public class NotificationUtils
extends java.lang.Object
Constructor and Description |
---|
NotificationUtils(android.content.Context mContext)
NotificationUtils's constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
clearNotifications(android.content.Context context)
Clears notification tray messages.
|
(package private) static boolean |
isAppInBackground(android.content.Context context)
Method checks if the app is in background or not.
|
(package private) void |
playNotificationSound()
Playing notification sound.
|
(package private) void |
showNotificationMessage(java.lang.String title,
java.lang.String message,
java.lang.String timeStamp,
android.content.Intent intent)
Show the notification message.
|
(package private) void |
showNotificationMessage(java.lang.String title,
java.lang.String message,
java.lang.String timeStamp,
android.content.Intent intent,
java.lang.String imageUrl)
Show the notification message with an image.
|
static void |
subscribeToTopic(android.content.Context context,
java.lang.String topic)
Subscribe the device to a topic.
|
static void |
unsubscribeFromAllTopics(android.content.Context context)
Unsubscribe the device from all topics.
|
static void |
unsubscribeFromTopic(android.content.Context context,
java.lang.String topic)
Unsubscribe the device from a topic.
|
NotificationUtils(android.content.Context mContext)
mContext
- The activity context.public static void subscribeToTopic(@NonNull android.content.Context context, @NonNull java.lang.String topic)
context
- The context.topic
- The topic.public static void unsubscribeFromAllTopics(@NonNull android.content.Context context)
context
- The context.public static void unsubscribeFromTopic(@NonNull android.content.Context context, @NonNull java.lang.String topic)
context
- The context.topic
- The topic.void showNotificationMessage(java.lang.String title, java.lang.String message, java.lang.String timeStamp, android.content.Intent intent)
title
- The notification title.message
- The notification message.timeStamp
- The notification timestamp.intent
- The intent.void showNotificationMessage(java.lang.String title, java.lang.String message, java.lang.String timeStamp, android.content.Intent intent, @Nullable java.lang.String imageUrl)
title
- The notification title.message
- The notification message.timeStamp
- The notification timestamp.intent
- The application intent.imageUrl
- The notification image url.void playNotificationSound()
static boolean isAppInBackground(android.content.Context context)
context
- The context.public static void clearNotifications(android.content.Context context)
context
- The context.