public class NotificationUtils
extends java.lang.Object
Created by Rahul on 20/9/16 @ 3:55 PM.
| Constructor and Description |
|---|
NotificationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static android.app.NotificationChannel |
createNotificationChannel(android.content.Context context,
Message message)
Creates a channel object with default details.
|
static void |
downloadCarouselImages(android.content.Context context,
Message message)
Downloads all carousel images and stores them inside app's private file location after compressing them.
|
static android.content.Intent |
getAddToCartActivityIntent(android.content.Context context,
Message message)
Get the activity marked as cart activity inside the configuration object with extras
|
static java.lang.String |
getImageFileName(java.lang.String url)
Extracts the file name from the image file url
|
static java.lang.String |
getNotificationChannelDescription(android.content.Context context,
Message message)
Reads a channel description from the config object
|
static java.lang.String |
getNotificationChannelId(android.content.Context context,
Message message)
Read the channel id provided in message or config.
|
static java.lang.String |
getNotificationChannelId(java.lang.String channelName)
Deprecated.
|
static java.lang.String |
getNotificationChannelName(android.content.Context context,
Message message)
Read default channel name from config if provided.
|
static android.content.Intent |
getNotificationEventsActivity(android.content.Context context,
java.lang.String action,
android.os.Bundle extras)
Checks for the activity responsible for handling notification clicks based on the action.
|
static android.content.Intent |
getOpenAppIntent(android.content.Context context,
Message message)
Get the activity marked as LAUNCHER in the AndroidManifest.xml
|
static android.content.Intent |
getViewCartActivityIntent(android.content.Context context,
Message message)
Get the activity marked as cart activity inside the configuration object
|
static android.content.Intent |
getViewOffersActivityIntent(android.content.Context context,
Message message)
Get the activity marked as offer display activity inside the configuration object
|
static android.content.Intent |
getViewProductActivityIntent(android.content.Context context,
Message message)
Get the activity marked as product details activity inside the configuration object with extras
|
static void |
invokePushClicked(android.content.Context context,
Message message,
java.lang.String clickUrl)
This helper method allows the sdk to call the listener method (if provided) along with
internal tracking method for push click.
|
static void |
invokePushDelivered(android.content.Context context,
Message message)
This helper method allows the sdk to call the listener method (if provided) along with
internal tracking method for push delivered.
|
static android.graphics.Bitmap |
loadImageFromDisc(android.content.Context context,
java.lang.String fileName)
Loads the image stored inside app's private file location
|
static android.graphics.Bitmap |
loadScaledBitmap(java.lang.String url,
int reqWidth,
int reqHeight) |
static boolean |
processNotificationClick(android.content.Context context,
android.content.Intent intent)
Simplified version of processNotificationClick(context, action, bundle)
|
static boolean |
processNotificationClick(android.content.Context context,
java.lang.String action,
android.os.Bundle bundle)
This is a helper method that can decide what needs to be done when someone clicks on push msg.
|
static void |
removeCachedCarouselImages(android.content.Context context,
Message message)
Method to remove all carousel images cached.
|
static void |
removeImageFromDisc(android.content.Context context,
java.lang.String fileName)
Remove file with given name from app's private files directory.
|
public static java.lang.String getImageFileName(java.lang.String url)
url - a valid image urlpublic static void downloadCarouselImages(android.content.Context context,
Message message)
context - valid context objectmessage - message object with valid carousel elementspublic static android.graphics.Bitmap loadImageFromDisc(android.content.Context context,
java.lang.String fileName)
context - valid context objectfileName - name of the image to be retrievedpublic static void removeImageFromDisc(android.content.Context context,
java.lang.String fileName)
context - valid context objectfileName - the name of the file to be removed.public static void removeCachedCarouselImages(android.content.Context context,
Message message)
context - valid context objectmessage - message with valid carousel elements@Deprecated public static java.lang.String getNotificationChannelId(java.lang.String channelName)
channelName - channel name for generating unique channel idpublic static java.lang.String getNotificationChannelId(android.content.Context context,
Message message)
context - valid Context objectmessage - message object to read the channel name frompublic static java.lang.String getNotificationChannelName(android.content.Context context,
Message message)
context - valid Context objectmessage - message object to read the channel name frompublic static java.lang.String getNotificationChannelDescription(android.content.Context context,
Message message)
context - valid context objectmessage - message object to read the channel name frompublic static android.app.NotificationChannel createNotificationChannel(android.content.Context context,
Message message)
message - valid Message objectpublic static android.content.Intent getNotificationEventsActivity(android.content.Context context,
java.lang.String action,
android.os.Bundle extras)
context - context object to create intentaction - action stringextras - extra params as bundlepublic static android.content.Intent getAddToCartActivityIntent(android.content.Context context,
Message message)
context - Application's context to get configuration objectmessage - Message object to get values required to add inside bundlepublic static android.content.Intent getViewCartActivityIntent(android.content.Context context,
Message message)
context - Application's context to get configuration objectmessage - Message object to get values required to add inside bundlepublic static android.content.Intent getViewProductActivityIntent(android.content.Context context,
Message message)
context - Application's context to get configuration objectmessage - Message object to get values required to add inside bundlepublic static android.content.Intent getViewOffersActivityIntent(android.content.Context context,
Message message)
context - Application's context to get configuration objectmessage - Message object to get values required to add inside bundlepublic static android.content.Intent getOpenAppIntent(android.content.Context context,
Message message)
context - Application's context to get configuration objectmessage - Message object to get values required to add inside bundlepublic static android.graphics.Bitmap loadScaledBitmap(java.lang.String url,
int reqWidth,
int reqHeight)
public static boolean processNotificationClick(android.content.Context context,
java.lang.String action,
android.os.Bundle bundle)
BlueshiftNotificationEventsActivity
The host app can make use of this method if they would like to override the clicks on push msg.context - valid context objectaction - action from the intentbundle - bundle inside the intentpublic static boolean processNotificationClick(android.content.Context context,
android.content.Intent intent)
context - valid context objectintent - valid intentpublic static void invokePushDelivered(android.content.Context context,
Message message)
context - valid Context objectmessage - valid Message objectpublic static void invokePushClicked(android.content.Context context,
Message message,
java.lang.String clickUrl)
context - valid Context objectmessage - valid Message object