public final class RecommendationExtender
extends Object implements Notification.Extender
| java.lang.Object | |
| android.support.app.recommendation.RecommendationExtender | |
助手类将内容信息扩展添加到通知。 使用内容信息扩展名创建通知:
Notification.Action.Builder, setting any desired properties. RecommendationExtender. add and set methods of RecommendationExtender. Notification.Builder.extend(Notification.Extender) to apply the extensions to a notification. Notification notification = new Notification.Builder(context) * ... * .extend(new RecommendationExtender() * .set*(...)) * .build(); *
通过使用 RecommendationExtender(Notification)构造函数,然后使用 get方法访问值,可以在现有通知上访问内容信息扩展。
Public constructors |
|
|---|---|
RecommendationExtender() 用默认选项创建一个 |
|
RecommendationExtender(Notification notif) 从现有通知的RecommendationExtender选项创建 |
|
公共方法(Public methods) |
|
|---|---|
Notification.Builder |
extend(Notification.Builder builder) 将内容扩展应用于正在构建的通知。 |
String[] |
getContentTypes() 返回包含描述与通知关联的内容的内容类型的数组。 |
String[] |
getGenres() 返回包含描述与通知关联的内容的内容类型的数组。 |
String |
getMaturityRating() 返回与通知关联的内容的成熟度等级评级。 |
String |
getPricingType() 获取与通知关联的内容的定价类型。 |
String |
getPricingValue() 获取与通知关联的内容的价格值(适用时)。 |
String |
getPrimaryContentType() 返回与通知关联的内容的主要内容类型标记。 |
long |
getRunningTime() 返回与通知关联的内容的运行时间。 |
int |
getStatus() 返回与通知关联的内容的状态值。 |
RecommendationExtender |
setContentTypes(String[] types) 设置与通知内容关联的内容类型。 |
RecommendationExtender |
setGenres(String[] genres) 设置与通知内容关联的内容流派。 |
RecommendationExtender |
setMaturityRating(String maturityRating) 设置与通知关联的内容的成熟度等级。 |
RecommendationExtender |
setPricingInformation(String priceType, String priceValue) 设置与通知关联的内容的定价和可用性信息。 |
RecommendationExtender |
setRunningTime(long length) 设置与通知关联的内容的运行时间(适用时)。 |
RecommendationExtender |
setStatus(int contentStatus) 设置与通知关联的内容的可用性状态。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.app.Notification.Extender
|
|
RecommendationExtender (Notification notif)
从现有通知的RecommendationExtender选项创建 RecommendationExtender 。
| 参数(Parameters) | |
|---|---|
notif |
Notification: The notification from which to copy options. |
Notification.Builder extend (Notification.Builder builder)
将内容扩展应用于正在构建的通知。 这通常由Notification.Builder.extend(Notification.Extender)方法Notification.Action.Builder 。
| 参数(Parameters) | |
|---|---|
builder |
Notification.Builder: the builder to be modified. |
| 返回(Returns) | |
|---|---|
Notification.Builder |
the build object for chaining. |
String[] getContentTypes ()
返回包含描述与通知关联的内容的内容类型的数组。 第一个标签条目被认为是内容的主要类型,并用于内容排名目的。
| 返回(Returns) | |
|---|---|
String[] |
An array of predefined type tags (see the CONTENT_TYPE_* constants) that describe the content associated with the notification. |
也可以看看:
String[] getGenres ()
返回包含描述与通知关联的内容的内容类型的数组。
| 返回(Returns) | |
|---|---|
String[] |
An array of genre tags that describe the content associated with the notification. |
也可以看看:
String getMaturityRating ()
返回与通知关联的内容的成熟度等级评级。
| 返回(Returns) | |
|---|---|
String |
returns a predefined tag indicating the maturity level rating for the content (see the CONTENT_MATURITY_* constants). |
也可以看看:
String getPricingType ()
获取与通知关联的内容的定价类型。
| 返回(Returns) | |
|---|---|
String |
A predefined tag indicating the pricing type for the content (see the CONTENT_PRICING_* constants). |
String getPricingValue ()
获取与通知关联的内容的价格值(适用时)。 该值将以字符串的形式提供,其中包含当前语言环境适当货币的价格。
| 返回(Returns) | |
|---|---|
String |
A string containing a representation of the content price in the current locale and currency. |
String getPrimaryContentType ()
返回与通知关联的内容的主要内容类型标记。
| 返回(Returns) | |
|---|---|
String |
A predefined type tag (see the CONTENT_TYPE_* constants) indicating the primary type for the content associated with the notification. |
也可以看看:
long getRunningTime ()
返回与通知关联的内容的运行时间。
| 返回(Returns) | |
|---|---|
long |
The running time, in seconds, of the content associated with the notification. |
也可以看看:
int getStatus ()
返回与通知关联的内容的状态值。 此状态指示引用的内容是否已准备好在设备上使用,或者用户是否必须先购买,租用,订阅或下载内容。
| 返回(Returns) | |
|---|---|
int |
The status value for this content, or -1 is a valid status has not been specified (see the CONTENT_STATUS_* for the defined valid status values). |
也可以看看:
RecommendationExtender setContentTypes (String[] types)
设置与通知内容关联的内容类型。 第一个标签条目将被视为内容的主要类型,并将用于排名目的。 如果适用的话,可以提供其他辅助类型标签,并且可以用于过滤目的。
| 参数(Parameters) | |
|---|---|
types |
String: Array of predefined type tags (see the CONTENT_TYPE_* constants) that describe the content referred to by a notification. |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
|
RecommendationExtender setGenres (String[] genres)
设置与通知内容关联的内容流派。 这些类型可用于内容排名。 流派是开放式结束字符串标记。
例如:“喜剧”,“动作”,“跳舞”,“电子乐”,“赛车”等。
| 参数(Parameters) | |
|---|---|
genres |
String: Array of genre string tags that describe the content referred to by a notification. |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
|
RecommendationExtender setMaturityRating (String maturityRating)
设置与通知关联的内容的成熟度等级。
| 参数(Parameters) | |
|---|---|
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 CONTENT_MATURITY_* constants). |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
|
RecommendationExtender setPricingInformation (String priceType, String priceValue)
设置与通知关联的内容的定价和可用性信息。 提供的信息将指示内容的访问模式(免费,租赁,购买或订阅)和价格(如果不是免费的)价值。
| 参数(Parameters) | |
|---|---|
priceType |
String: Pricing type for this content. Must be one of the predefined pricing type tags (see the CONTENT_PRICING_* constants). |
priceValue |
String: A string containing a representation of the content price in the current locale and currency. |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
This object for method chaining. |
RecommendationExtender setRunningTime (long length)
设置与通知关联的内容的运行时间(适用时)。
| 参数(Parameters) | |
|---|---|
length |
long: The runing time, in seconds, of the content associated with the notification. |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
|
RecommendationExtender setStatus (int contentStatus)
设置与通知关联的内容的可用性状态。 此状态指示引用的内容是否已准备好在设备上使用,或者用户是否必须先购买,租用,订阅或下载内容。
| 参数(Parameters) | |
|---|---|
contentStatus |
int: The status value for this content. Must be one of the predefined content status values (see the CONTENT_STATUS_* constants). |
| 返回(Returns) | |
|---|---|
RecommendationExtender |
|