SubscriptionPlan.Builder
public
static
class
SubscriptionPlan.Builder
extends Object
| java.lang.Object | |
| ↳ | android.telephony.SubscriptionPlan.Builder |
Builder for a SubscriptionPlan.
Summary
Public methods | |
|---|---|
SubscriptionPlan
|
build()
|
static
SubscriptionPlan.Builder
|
createNonrecurring(ZonedDateTime start, ZonedDateTime end)
Start defining a |
static
SubscriptionPlan.Builder
|
createRecurring(ZonedDateTime start, Period period)
Start defining a |
SubscriptionPlan.Builder
|
resetNetworkTypes()
Reset any network types that were set with |
SubscriptionPlan.Builder
|
setDataLimit(long dataLimitBytes, int dataLimitBehavior)
Set the usage threshold at which data access changes. |
SubscriptionPlan.Builder
|
setDataUsage(long dataUsageBytes, long dataUsageTime)
Set a snapshot of currently known mobile data usage. |
SubscriptionPlan.Builder
|
setNetworkTypes(int[] networkTypes)
Set the network types this SubscriptionPlan applies to. |
SubscriptionPlan.Builder
|
setSubscriptionStatus(int subscriptionStatus)
Set the subscription status. |
SubscriptionPlan.Builder
|
setSummary(CharSequence summary)
Sets a brief, human-readable summary of the subscription plan. |
SubscriptionPlan.Builder
|
setTitle(CharSequence title)
Sets a user-visible title for this plan. |
Inherited methods | |
|---|---|
Public methods
createNonrecurring
public static SubscriptionPlan.Builder createNonrecurring (ZonedDateTime start, ZonedDateTime end)
Start defining a SubscriptionPlan that covers a very specific window of time, and
never automatically recurs.
| Parameters | |
|---|---|
start |
ZonedDateTime: The exact time at which the plan starts. |
end |
ZonedDateTime: The exact time at which the plan ends. |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
|
createRecurring
public static SubscriptionPlan.Builder createRecurring (ZonedDateTime start, Period period)
Start defining a SubscriptionPlan that starts at a specific time, and
automatically recurs after each specific period of time, repeating indefinitely.
When the given period is set to exactly one month, the plan will always recur on the day
of the month defined by ZonedDateTime.getDayOfMonth(). When a particular month
ends before this day, the plan will recur on the last possible instant of that month.
| Parameters | |
|---|---|
start |
ZonedDateTime: The exact time at which the plan starts. |
period |
Period: The period after which the plan automatically recurs. |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
|
resetNetworkTypes
public SubscriptionPlan.Builder resetNetworkTypes ()
Reset any network types that were set with setNetworkTypes(int[]).
This will make the SubscriptionPlan apply to all network types.
| Returns | |
|---|---|
SubscriptionPlan.Builder |
This value cannot be null. |
setDataLimit
public SubscriptionPlan.Builder setDataLimit (long dataLimitBytes, int dataLimitBehavior)
Set the usage threshold at which data access changes.
| Parameters | |
|---|---|
dataLimitBytes |
long: the usage threshold at which data access changes.
Value is a non-negative number of bytes. |
dataLimitBehavior |
int: the behavior of data access when usage reaches the threshold.
Value is one of the following: |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
|
setDataUsage
public SubscriptionPlan.Builder setDataUsage (long dataUsageBytes, long dataUsageTime)
Set a snapshot of currently known mobile data usage.
| Parameters | |
|---|---|
dataUsageBytes |
long: the currently known mobile data usage.
Value is a non-negative number of bytes. |
dataUsageTime |
long: the time at which this snapshot was valid.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
|
setNetworkTypes
public SubscriptionPlan.Builder setNetworkTypes (int[] networkTypes)
Set the network types this SubscriptionPlan applies to. By default the plan will apply to all network types. An empty array means this plan applies to no network types.
| Returns | |
|---|---|
SubscriptionPlan.Builder |
This value cannot be null. |
setSubscriptionStatus
public SubscriptionPlan.Builder setSubscriptionStatus (int subscriptionStatus)
Set the subscription status.
This indicates the current state of the subscription, such as whether it is active, suspended, or in a trial period. This status provides context on the plan's availability and can be used to inform the user about their subscription's lifecycle.
| Parameters | |
|---|---|
subscriptionStatus |
int: the current subscription status.
Value is one of the following: |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
This value cannot be null. |
setSummary
public SubscriptionPlan.Builder setSummary (CharSequence summary)
Sets a brief, human-readable summary of the subscription plan.
This could include details about the plan's features, such as "10GB of high-speed data" or "Unlimited talk and text". This summary is intended for display to the user.
| Parameters | |
|---|---|
summary |
CharSequence: A short, user-friendly summary of the plan, or null to clear it. |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
|
setTitle
public SubscriptionPlan.Builder setTitle (CharSequence title)
Sets a user-visible title for this plan.
This title is provided by the carrier to identify the subscription plan, for example, "Unlimited+" or "Family plan". It is intended for display to the user.
| Parameters | |
|---|---|
title |
CharSequence: The title of the plan.
This value may be null. |
| Returns | |
|---|---|
SubscriptionPlan.Builder |
The same Builder instance to continue building the plan. |