public class TuneNotificationBuilder extends Object
Constructor and Description |
---|
TuneNotificationBuilder(int smallIconId)
Creates a new TuneNotificationBuilder to pass into
Tune.setPushNotificationBuilder(com.tune.ma.push.settings.TuneNotificationBuilder) . |
Modifier and Type | Method and Description |
---|---|
NotificationCompat.Builder |
build(Context context)
Builds a NotificationCompat.Builder from the provided push notification settings.
|
static TuneNotificationBuilder |
fromJson(String json) |
boolean |
hasCustomization() |
TuneNotificationBuilder |
setColor(int argb)
Set the accent color for Tune Push Notifications.
|
TuneNotificationBuilder |
setGroup(String groupKey)
Set this notification to be part of a group of notifications sharing the same key.
|
TuneNotificationBuilder |
setLargeIcon(int largeIconId)
Set the large icon that is shown in Tune Push Notifications.
|
TuneNotificationBuilder |
setSortKey(String sortKey)
Set a sort key that orders this notification among other notifications from the same package.
|
TuneNotificationBuilder |
setVisibility(int visibility)
Set the visibility level for Tune Push Notifications.
|
JSONObject |
toJson() |
public TuneNotificationBuilder(int smallIconId)
Tune.setPushNotificationBuilder(com.tune.ma.push.settings.TuneNotificationBuilder)
. TuneNotificationBuilder
API.
int smallIcon;
if (Build.VERSION.SDK_INT >= 21) {
smallIcon = R.drawable.your_icon;
} else {
smallIcon = R.drawable.your_other_icon;
}
TuneNotificationBuilder builder = new TuneNotificationBuilder(smallIcon);
smallIconId
- Android resource Id for the small notification icon.public TuneNotificationBuilder setLargeIcon(int largeIconId)
largeIconId
- Android resource Id for the large notification icon.public TuneNotificationBuilder setSortKey(String sortKey)
sortKey
- sort key for Notifications from Tune Push.public TuneNotificationBuilder setGroup(String groupKey)
groupKey
- group key if you would like to group Tune Push Notifications together.public TuneNotificationBuilder setColor(int argb)
argb
- set the accent colorpublic TuneNotificationBuilder setVisibility(int visibility)
visibility
- visibility level, One of NotificationCompat.VISIBILITY_PRIVATE (the default), NotificationCompat.VISIBILITY_SECRET, or NotificationCompat.VISIBILITY_PUBLIC.public NotificationCompat.Builder build(Context context)
public boolean hasCustomization()
public JSONObject toJson() throws JSONException
JSONException
public static TuneNotificationBuilder fromJson(String json) throws JSONException
JSONException