Added in API level 28

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 SubscriptionPlan that covers a very specific window of time, and never automatically recurs.

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.

SubscriptionPlan.Builder resetNetworkTypes()

Reset any network types that were set with setNetworkTypes(int[]).

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 setSummary(CharSequence summary)

Set the short summary of this plan.

SubscriptionPlan.Builder setTitle(CharSequence title)

Set the short title of this plan.

Inherited methods

Public methods

build

Added in API level 28
public SubscriptionPlan build ()

Returns
SubscriptionPlan

createNonrecurring

Added in API level 28
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

Added in API level 28
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

Added in API level 30
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

Added in API level 28
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 SubscriptionPlan.LIMIT_BEHAVIOR_UNKNOWN, SubscriptionPlan.LIMIT_BEHAVIOR_DISABLED, SubscriptionPlan.LIMIT_BEHAVIOR_BILLED, or SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED

Returns
SubscriptionPlan.Builder

setDataUsage

Added in API level 28
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

Added in API level 30
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.

Parameters
networkTypes int: an array of all network types that apply to this plan. This value cannot be null. Value is TelephonyManager.NETWORK_TYPE_UNKNOWN, TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_CDMA, TelephonyManager.NETWORK_TYPE_EVDO_0, TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyManager.NETWORK_TYPE_1xRTT, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, TelephonyManager.NETWORK_TYPE_HSPA, TelephonyManager.NETWORK_TYPE_IDEN, TelephonyManager.NETWORK_TYPE_EVDO_B, TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_EHRPD, TelephonyManager.NETWORK_TYPE_HSPAP, TelephonyManager.NETWORK_TYPE_GSM, TelephonyManager.NETWORK_TYPE_TD_SCDMA, TelephonyManager.NETWORK_TYPE_IWLAN, or TelephonyManager.NETWORK_TYPE_NR

Returns
SubscriptionPlan.Builder This value cannot be null.

setSummary

Added in API level 28
public SubscriptionPlan.Builder setSummary (CharSequence summary)

Set the short summary of this plan.

Parameters
summary CharSequence: This value may be null.

Returns
SubscriptionPlan.Builder

setTitle

Added in API level 28
public SubscriptionPlan.Builder setTitle (CharSequence title)

Set the short title of this plan.

Parameters
title CharSequence: This value may be null.

Returns
SubscriptionPlan.Builder