ContentRecommendation
class ContentRecommendation
The ContentRecommendation object encapsulates all application provided data for a single content recommendation item.
Summary
Nested types |
|---|
|
Builder class for |
@StringDef(value = ) |
@StringDef(value = ) |
@IntDef(value = ) |
@StringDef(value = ) |
|
Object used to encapsulate the data to be used to build the |
@IntDef(value = ) |
Constants |
|
|---|---|
const String! |
CONTENT_MATURITY_ALL = "android.contentMaturity.all"Value to be used with |
const String! |
CONTENT_MATURITY_HIGH = "android.contentMaturity.high"Value to be used with |
const String! |
CONTENT_MATURITY_LOW = "android.contentMaturity.low"Value to be used with |
const String! |
CONTENT_MATURITY_MEDIUM = "android.contentMaturity.medium"Value to be used with |
const String! |
CONTENT_PRICING_FREE = "android.contentPrice.free"Value to be used with |
const String! |
CONTENT_PRICING_PREORDER = "android.contentPrice.preorder"Value to be used with |
const String! |
CONTENT_PRICING_PURCHASE = "android.contentPrice.purchase"Value to be used with |
const String! |
CONTENT_PRICING_RENTAL = "android.contentPrice.rental"Value to be used with |
const String! |
CONTENT_PRICING_SUBSCRIPTION = "android.contentPrice.subscription"Value to be used with |
const Int |
Value to be used with |
const Int |
Value to be used with |
const Int |
Value to be used with |
const Int |
Value to be used with |
const String! |
CONTENT_TYPE_APP = "android.contentType.app"Value to be used with |
const String! |
CONTENT_TYPE_BOOK = "android.contentType.book"Value to be used with |
const String! |
CONTENT_TYPE_COMIC = "android.contentType.comic"Value to be used with |
const String! |
CONTENT_TYPE_GAME = "android.contentType.game"Value to be used with |
const String! |
CONTENT_TYPE_MAGAZINE = "android.contentType.magazine"Value to be used with |
const String! |
CONTENT_TYPE_MOVIE = "android.contentType.movie"Value to be used with |
const String! |
CONTENT_TYPE_MUSIC = "android.contentType.music"Value to be used with |
const String! |
CONTENT_TYPE_NEWS = "android.contentType.news"Value to be used with |
const String! |
CONTENT_TYPE_PODCAST = "android.contentType.podcast"Value to be used with |
const String! |
CONTENT_TYPE_RADIO = "android.contentType.radio"Value to be used with |
const String! |
CONTENT_TYPE_SERIAL = "android.contentType.serial"Value to be used with |
const String! |
CONTENT_TYPE_SPORTS = "android.contentType.sports"Value to be used with |
const String! |
CONTENT_TYPE_TRAILER = "android.contentType.trailer"Value to be used with |
const String! |
CONTENT_TYPE_VIDEO = "android.contentType.video"Value to be used with |
const String! |
CONTENT_TYPE_WEBSITE = "android.contentType.website"Value to be used with |
const Int |
Value to be used with |
const Int |
Value to be used with |
const Int |
Value to be used with |
Public functions |
|
|---|---|
Boolean |
|
String! |
Returns a Content URI that can be used to retrieve the background image for this recommendation. |
Int |
Returns the resource id for the recommendation badging icon. |
Int |
getColor()Returns the accent color value to be used in the UI when displaying this content recommendation to the user. |
Bitmap! |
Returns the Bitmap containing the recommendation image. |
ContentRecommendation.IntentData! |
Returns the data for the Intent that will be issued when the user clicks on the recommendation. |
Array<String!>! |
Returns an array containing the content types tags that describe the content. |
ContentRecommendation.IntentData! |
Returns the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action. |
Array<String!>! |
Returns an array containing the genres that describe the content. |
String! |
getGroup()Returns the String group ID tag for this recommendation. |
String! |
getIdTag()Returns the String Id tag which uniquely identifies this recommendation. |
String! |
Returns the maturity level rating for the content. |
Notification! |
getNotificationObject(context: Context!)Returns a |
String! |
Gets the pricing type for the content. |
String! |
Gets the price value (when applicable) for the content. |
String! |
Returns the primary content type tag for the recommendation, or null if no content types have been specified. |
Int |
Returns the maximum value for the progress data of this recommendation. |
Int |
Returns the progress amount for this recommendation. |
Long |
Returns the running time for the content. |
String! |
Returns the String sort key for this recommendation. |
String! |
Returns the source application name for this recommendation. |
Int |
Returns availability status value for the content. |
String! |
getText()Returns the description text for this recommendation. |
String! |
getTitle()Returns the content title for this recommendation. |
Boolean |
Indicates if this recommendation contains valid progress information. |
Int |
hashCode() |
Boolean |
Indicates whether this recommendation should be dismissed automatically. |
Unit |
setAutoDismiss(autoDismiss: Boolean)Sets the flag indicating if this recommendation should be dismissed automatically. |
Unit |
Sets the String group ID tag for this recommendation. |
Unit |
setProgress(max: Int, progress: Int)Sets the progress information for the content pointed to by this recommendation. |
Unit |
setSortKey(sortKey: String!)Sets the String sort key for this recommendation. |
Unit |
setStatus(@ContentRecommendation.ContentStatus status: Int)Sets the availability status value for the content. |
Constants
CONTENT_MATURITY_ALL
const val CONTENT_MATURITY_ALL = "android.contentMaturity.all": String!
Value to be used with setMaturityRating to indicate that the content referred by the notification is suitable for all audiences.
CONTENT_MATURITY_HIGH
const val CONTENT_MATURITY_HIGH = "android.contentMaturity.high": String!
Value to be used with setMaturityRating to indicate that the content referred by the notification is suitable for audiences of high maturity and above.
CONTENT_MATURITY_LOW
const val CONTENT_MATURITY_LOW = "android.contentMaturity.low": String!
Value to be used with setMaturityRating to indicate that the content referred by the notification is suitable for audiences of low maturity and above.
CONTENT_MATURITY_MEDIUM
const val CONTENT_MATURITY_MEDIUM = "android.contentMaturity.medium": String!
Value to be used with setMaturityRating to indicate that the content referred by the notification is suitable for audiences of medium maturity and above.
CONTENT_PRICING_FREE
const val CONTENT_PRICING_FREE = "android.contentPrice.free": String!
Value to be used with setPricingInformation to indicate that the content referred by the notification item is free to consume.
CONTENT_PRICING_PREORDER
const val CONTENT_PRICING_PREORDER = "android.contentPrice.preorder": String!
Value to be used with setPricingInformation to indicate that the content referred by the notification item is available currently as a pre-order, and the price value provided is the purchase price for the item.
CONTENT_PRICING_PURCHASE
const val CONTENT_PRICING_PURCHASE = "android.contentPrice.purchase": String!
Value to be used with setPricingInformation to indicate that the content referred by the notification item is available for purchase, and the price value provided is the purchase price for the item.
CONTENT_PRICING_RENTAL
const val CONTENT_PRICING_RENTAL = "android.contentPrice.rental": String!
Value to be used with setPricingInformation to indicate that the content referred by the notification item is available as a rental, and the price value provided is the rental price for the item.
CONTENT_PRICING_SUBSCRIPTION
const val CONTENT_PRICING_SUBSCRIPTION = "android.contentPrice.subscription": String!
Value to be used with setPricingInformation to indicate that the content referred by the notification item is available as part of a subscription based service, and the price value provided is the subscription price for the service.
CONTENT_STATUS_AVAILABLE
const val CONTENT_STATUS_AVAILABLE = 2: Int
Value to be used with setStatus to indicate that the content referred by the notification is available, but needs to be first purchased, rented, subscribed or downloaded before it can be consumed.
CONTENT_STATUS_PENDING
const val CONTENT_STATUS_PENDING = 1: Int
Value to be used with setStatus to indicate that the content referred by the notification is pending, waiting on either a download or purchase operation to complete before it can be consumed.
CONTENT_STATUS_READY
const val CONTENT_STATUS_READY = 0: Int
Value to be used with setStatus to indicate that the content referred by the notification is available and ready to be consumed immediately.
CONTENT_STATUS_UNAVAILABLE
const val CONTENT_STATUS_UNAVAILABLE = 3: Int
Value to be used with setStatus to indicate that the content referred by the notification is not available. This could be content not available in a certain region or incompatible with the device in use.
CONTENT_TYPE_APP
const val CONTENT_TYPE_APP = "android.contentType.app": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is an application.
CONTENT_TYPE_BOOK
const val CONTENT_TYPE_BOOK = "android.contentType.book": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a book.
CONTENT_TYPE_COMIC
const val CONTENT_TYPE_COMIC = "android.contentType.comic": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a comic book.
CONTENT_TYPE_GAME
const val CONTENT_TYPE_GAME = "android.contentType.game": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a game.
CONTENT_TYPE_MAGAZINE
const val CONTENT_TYPE_MAGAZINE = "android.contentType.magazine": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a magazine.
CONTENT_TYPE_MOVIE
const val CONTENT_TYPE_MOVIE = "android.contentType.movie": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a movie.
CONTENT_TYPE_MUSIC
const val CONTENT_TYPE_MUSIC = "android.contentType.music": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a song or album.
CONTENT_TYPE_NEWS
const val CONTENT_TYPE_NEWS = "android.contentType.news": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a news item.
CONTENT_TYPE_PODCAST
const val CONTENT_TYPE_PODCAST = "android.contentType.podcast": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a podcast.
CONTENT_TYPE_RADIO
const val CONTENT_TYPE_RADIO = "android.contentType.radio": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a radio station.
CONTENT_TYPE_SERIAL
const val CONTENT_TYPE_SERIAL = "android.contentType.serial": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is serial. It can refer to an entire show, a single season or series, or a single episode.
CONTENT_TYPE_SPORTS
const val CONTENT_TYPE_SPORTS = "android.contentType.sports": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is sports.
CONTENT_TYPE_TRAILER
const val CONTENT_TYPE_TRAILER = "android.contentType.trailer": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a trailer.
CONTENT_TYPE_VIDEO
const val CONTENT_TYPE_VIDEO = "android.contentType.video": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a video clip.
CONTENT_TYPE_WEBSITE
const val CONTENT_TYPE_WEBSITE = "android.contentType.website": String!
Value to be used with setContentTypes to indicate that the content referred by the notification item is a website.
INTENT_TYPE_ACTIVITY
const val INTENT_TYPE_ACTIVITY = 1: Int
Value to be used with setContentIntentData and setDismissIntentData to indicate that a PendingIntent for an Activity should be created when posting the recommendation to the HomeScreen.
INTENT_TYPE_BROADCAST
const val INTENT_TYPE_BROADCAST = 2: Int
Value to be used with setContentIntentData and setDismissIntentData to indicate that a PendingIntent for a Broadcast should be created when posting the recommendation to the HomeScreen.
INTENT_TYPE_SERVICE
const val INTENT_TYPE_SERVICE = 3: Int
Value to be used with setContentIntentData and setDismissIntentData to indicate that a PendingIntent for a Service should be created when posting the recommendation to the HomeScreen.
Public functions
getBackgroundImageUri
fun getBackgroundImageUri(): String!
Returns a Content URI that can be used to retrieve the background image for this recommendation.
| Returns | |
|---|---|
String! |
A Content URI pointing to the recommendation background image. |
getBadgeImageResourceId
fun getBadgeImageResourceId(): Int
Returns the resource id for the recommendation badging icon.
The resource id represents the icon resource in the source application package.
| Returns | |
|---|---|
Int |
An integer id for the badge icon resource. |
getColor
fun getColor(): Int
Returns the accent color value to be used in the UI when displaying this content recommendation to the user.
| Returns | |
|---|---|
Int |
An integer value representing the accent color for this recommendation. |
getContentImage
fun getContentImage(): Bitmap!
Returns the Bitmap containing the recommendation image.
| Returns | |
|---|---|
Bitmap! |
A Bitmap containing the recommendation image. |
getContentIntent
fun getContentIntent(): ContentRecommendation.IntentData!
Returns the data for the Intent that will be issued when the user clicks on the recommendation.
| Returns | |
|---|---|
ContentRecommendation.IntentData! |
An IntentData object, containing the data for the Intent that gets issued when the recommendation is clicked on. |
getContentTypes
fun getContentTypes(): Array<String!>!
Returns an array containing the content types tags that describe the content. The first tag entry is considered the primary type for the content, and is used for content ranking purposes.
getDismissIntent
fun getDismissIntent(): ContentRecommendation.IntentData!
Returns the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action.
| Returns | |
|---|---|
ContentRecommendation.IntentData! |
An IntentData object, containing the data for the Intent that gets issued when the recommendation is dismissed from the Home Screen. |
getGenres
fun getGenres(): Array<String!>!
Returns an array containing the genres that describe the content. Genres are open ended String tags.
getGroup
fun getGroup(): String!
Returns the String group ID tag for this recommendation.
| Returns | |
|---|---|
String! |
A String containing the group ID tag for this recommendation. |
getIdTag
fun getIdTag(): String!
Returns the String Id tag which uniquely identifies this recommendation.
| Returns | |
|---|---|
String! |
The String Id tag for this recommendation. |
getMaturityRating
fun getMaturityRating(): String!
Returns the maturity level rating for the content.
| Returns | |
|---|---|
String! |
returns a predefined tag indicating the maturity level rating for the content (see the |
getNotificationObject
fun getNotificationObject(context: Context!): Notification!
Returns a Notification object which contains the content recommendation data encapsulated by this object, which can be used for posting the recommendation via the NotificationManager.
| Parameters | |
|---|---|
context: Context! |
A |
| Returns | |
|---|---|
Notification! |
A |
getPricingType
fun getPricingType(): String!
Gets the pricing type for the content.
| Returns | |
|---|---|
String! |
A predefined tag indicating the pricing type for the content (see the |
getPricingValue
fun getPricingValue(): String!
Gets the price value (when applicable) for the content. 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. |
getPrimaryContentType
fun getPrimaryContentType(): String!
Returns the primary content type tag for the recommendation, or null if no content types have been specified.
| Returns | |
|---|---|
String! |
A predefined type tag (see the |
getProgressMax
fun getProgressMax(): Int
Returns the maximum value for the progress data of this recommendation.
| Returns | |
|---|---|
Int |
An integer representing the maximum progress value. |
getProgressValue
fun getProgressValue(): Int
Returns the progress amount for this recommendation.
| Returns | |
|---|---|
Int |
An integer representing the recommendation progress amount. |
getRunningTime
fun getRunningTime(): Long
Returns the running time for the content.
| Returns | |
|---|---|
Long |
The run length, in seconds, of the content associated with the notification. |
getSortKey
fun getSortKey(): String!
Returns the String sort key for this recommendation.
| Returns | |
|---|---|
String! |
A String containing the sort key for this recommendation. |
getSourceName
fun getSourceName(): String!
Returns the source application name for this recommendation.
| Returns | |
|---|---|
String! |
A String containing the recommendation source name. |
getStatus
fun getStatus(): Int
Returns availability status value for the content. This status indicates whether the 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 the content, or -1 is a valid status has not been specified (see the |
getText
fun getText(): String!
Returns the description text for this recommendation.
| Returns | |
|---|---|
String! |
A String containing the recommendation description text. |
getTitle
fun getTitle(): String!
Returns the content title for this recommendation.
| Returns | |
|---|---|
String! |
A String containing the recommendation content title. |
hasProgressInfo
fun hasProgressInfo(): Boolean
Indicates if this recommendation contains valid progress information.
| Returns | |
|---|---|
Boolean |
true if the recommendation contains valid progress data, false otherwise. |
isAutoDismiss
fun isAutoDismiss(): Boolean
Indicates whether this recommendation should be dismissed automatically.
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
| Returns | |
|---|---|
Boolean |
true if the recommendation is marked for auto dismissal, or false otherwise. |
setAutoDismiss
fun setAutoDismiss(autoDismiss: Boolean): Unit
Sets the flag indicating if this recommendation should be dismissed automatically.
Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.
| Parameters | |
|---|---|
autoDismiss: Boolean |
A boolean indicating if the recommendation should be auto dismissed or not. |
setGroup
fun setGroup(groupTag: String!): Unit
Sets the String group ID tag for this recommendation.
Recommendations in the same group are ranked by the Home Screen together, and the sort order within a group is respected. This can be useful if the application has different sources for recommendations, like "trending", "subscriptions", and "new music" categories for YouTube, where the user can be more interested in recommendations from one group than another.
| Parameters | |
|---|---|
groupTag: String! |
A String containing the group ID tag for this recommendation. |
setProgress
fun setProgress(max: Int, progress: Int): Unit
Sets the progress information for the content pointed to by this recommendation.
setSortKey
fun setSortKey(sortKey: String!): Unit
Sets the String sort key for this recommendation.
The sort key must be a String representation of a float number between 0.0 and 1.0, and is used to indicate the relative importance (and sort order) of a single recommendation within its specified group. The recommendations will be ordered in decreasing order of importance within a given group.
| Parameters | |
|---|---|
sortKey: String! |
A String containing the sort key for this recommendation. |
setStatus
fun setStatus(@ContentRecommendation.ContentStatus status: Int): Unit
Sets the availability status value for the content. This status indicates whether the 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 status: Int |
The status value for the content. (see the |