RecommendationExtender
class RecommendationExtender : Notification.Extender
Helper class to add content info extensions to notifications. To create a notification with content info extensions:
- Create an
Notification.Builder, setting any desired properties. - Create a
RecommendationExtender. - Set content info specific properties using the
addandsetmethods ofRecommendationExtender. - Call
Notification.Builder.extend(Notification.Extender)to apply the extensions to a notification.
Notification notification = new Notification.Builder(context) * ... * .extend(new RecommendationExtender() * .set*(...)) * .build(); *
Content info extensions can be accessed on an existing notification by using the RecommendationExtender(Notification) constructor, and then using the get methods to access values.
Summary
Public constructors |
|---|
|
Create a |
RecommendationExtender(notif: Notification!)Create a |
Public functions |
|
|---|---|
Notification.Builder! |
extend(builder: Notification.Builder!)Apply content extensions to a notification that is being built. |
Array<String!>! |
Returns an array containing the content types that describe the content associated with the notification. |
Array<String!>! |
Returns an array containing the content genres that describe the content associated with the notification. |
String! |
Returns the maturity level rating for the content associated with the notification. |
String! |
Gets the pricing type for the content associated with the notification. |
String! |
Gets the price value (when applicable) for the content associated with a notification. |
String! |
Returns the primary content type tag for the content associated with the notification. |
Long |
Returns the running time for the content associated with the notification. |
Int |
Returns status value for the content associated with the notification. |
RecommendationExtender! |
setContentTypes(types: Array<String!>!)Sets the content types associated with the notification content. |
RecommendationExtender! |
Sets the content genres associated with the notification content. |
RecommendationExtender! |
setMaturityRating(Sets the maturity level rating for the content associated with the notification. |
RecommendationExtender! |
setPricingInformation(Sets the pricing and availability information for the content associated with the notification. |
RecommendationExtender! |
setRunningTime(length: Long)Sets the running time (when applicable) for the content associated with the notification. |
RecommendationExtender! |
setStatus(@ContentRecommendation.ContentStatus contentStatus: Int)Sets the availability status for the content associated with the notification. |
Public constructors
RecommendationExtender
RecommendationExtender()
Create a RecommendationExtender with default options.
RecommendationExtender
RecommendationExtender(notif: Notification!)
Create a RecommendationExtender from the RecommendationExtender options of an existing Notification.
| Parameters | |
|---|---|
notif: Notification! |
The notification from which to copy options. |
Public functions
extend
fun extend(builder: Notification.Builder!): Notification.Builder!
Apply content extensions to a notification that is being built. This is typically called by the Notification.Builder.extend(Notification.Extender) method of Notification.Builder.
getContentTypes
fun getContentTypes(): Array<String!>!
Returns an array containing the content types that describe the content associated with the notification. The first tag entry is considered the primary type for the content, and is used for content ranking purposes.
| Returns | |
|---|---|
Array<String!>! |
An array of predefined type tags (see the |
| See also | |
|---|---|
setContentTypes |
getGenres
fun getGenres(): Array<String!>!
Returns an array containing the content genres that describe the content associated with the notification.
| Returns | |
|---|---|
Array<String!>! |
An array of genre tags that describe the content associated with the notification. |
| See also | |
|---|---|
setGenres |
getMaturityRating
fun getMaturityRating(): String!
Returns the maturity level rating for the content associated with the notification.
| Returns | |
|---|---|
String! |
returns a predefined tag indicating the maturity level rating for the content (see the |
| See also | |
|---|---|
setMaturityRating |
getPricingType
fun getPricingType(): String!
Gets the pricing type for the content associated with the notification.
| Returns | |
|---|---|
String! |
A predefined tag indicating the pricing type for the content (see the |
| See also | |
|---|---|
setPricingInformation |
getPricingValue
fun getPricingValue(): String!
Gets the price value (when applicable) for the content associated with a notification. The value will be provided as a String containing the price in the appropriate currency for the current locale.
| Returns | |
|---|---|
String! |
A string containing a representation of the content price in the current locale and currency. |
| See also | |
|---|---|
setPricingInformation |
getPrimaryContentType
fun getPrimaryContentType(): String!
Returns the primary content type tag for the content associated with the notification.
| Returns | |
|---|---|
String! |
A predefined type tag (see the |
| See also | |
|---|---|
setContentTypes |
getRunningTime
fun getRunningTime(): Long
Returns the running time for the content associated with the notification.
| Returns | |
|---|---|
Long |
The running time, in seconds, of the content associated with the notification. |
| See also | |
|---|---|
setRunningTime |
getStatus
fun getStatus(): Int
Returns status value for the content associated with the notification. This status indicates whether the referred content is ready to be consumed on the device, or if the user must first purchase, rent, subscribe to, or download the content.
| Returns | |
|---|---|
Int |
The status value for this content, or -1 is a valid status has not been specified (see the |
| See also | |
|---|---|
setStatus |
setContentTypes
fun setContentTypes(types: Array<String!>!): RecommendationExtender!
Sets the content types associated with the notification content. The first tag entry will be considered the primary type for the content and will be used for ranking purposes. Other secondary type tags may be provided, if applicable, and may be used for filtering purposes.
setGenres
fun setGenres(genres: Array<String!>!): RecommendationExtender!
Sets the content genres associated with the notification content. These genres may be used for content ranking. Genres are open ended String tags.
Some examples: "comedy", "action", "dance", "electronica", "racing", etc.
setMaturityRating
fun setMaturityRating(
@ContentRecommendation.ContentMaturity maturityRating: String!
): RecommendationExtender!
Sets the maturity level rating for the content associated with the notification.
| Parameters | |
|---|---|
@ContentRecommendation.ContentMaturity maturityRating: String! |
A tag indicating the maturity level rating for the content. This tag must be one of the predefined maturity rating tags (see the |
setPricingInformation
fun setPricingInformation(
@ContentRecommendation.ContentPricing priceType: String!,
priceValue: String!
): RecommendationExtender!
Sets the pricing and availability information for the content associated with the notification. The provided information will indicate the access model for the content (free, rental, purchase or subscription) and the price value (if not free).
| Parameters | |
|---|---|
@ContentRecommendation.ContentPricing priceType: String! |
Pricing type for this content. Must be one of the predefined pricing type tags (see the |
priceValue: String! |
A string containing a representation of the content price in the current locale and currency. |
| Returns | |
|---|---|
RecommendationExtender! |
This object for method chaining. |
setRunningTime
fun setRunningTime(length: Long): RecommendationExtender!
Sets the running time (when applicable) for the content associated with the notification.
| Parameters | |
|---|---|
length: Long |
The runing time, in seconds, of the content associated with the notification. |
setStatus
fun setStatus(@ContentRecommendation.ContentStatus contentStatus: Int): RecommendationExtender!
Sets the availability status for the content associated with the notification. This status indicates whether the referred content is ready to be consumed on the device, or if the user must first purchase, rent, subscribe to, or download the content.
| Parameters | |
|---|---|
@ContentRecommendation.ContentStatus contentStatus: Int |
The status value for this content. Must be one of the predefined content status values (see the |