FileUploadPreferences

public interface FileUploadPreferences

This interface was deprecated.
Use TransferPreferences and TransferPreferencesBuilder instead.

Represents the file upload preferences associated with the current account. The preferences set by these APIs are applied only to the current user account and the calling application.

For example, the preference values for the file upload operations of the calling application can be fetched using getFileUploadPreferences(GoogleApiClient). These preference values can be modified using setNetworkTypePreference(int), setRoamingAllowed(boolean) or setBatteryUsagePreference(int) and then saved by executing the setFileUploadPreferences(GoogleApiClient, FileUploadPreferences) method.

Constant Summary

int BATTERY_USAGE_CHARGING_ONLY This value signifies that the operations by the calling application are allowed only when the device is plugged into a power source.
int BATTERY_USAGE_UNRESTRICTED This value signifies that the operations by the calling application are allowed immediately without being restricted on the current battery status of the device.
int NETWORK_TYPE_ANY This value signifies that the operations by the calling application are not restricted to any specific network type and can be applied over any available network connection (i.e.
int NETWORK_TYPE_WIFI_ONLY This value signifies that the operations by the calling application are allowed only over a WIFI network connection.
int PREFERENCE_VALUE_UNKNOWN This value signifies that the preference value is unknown to the calling application.

Public Method Summary

abstract int
getBatteryUsagePreference()
Returns the current battery usage preference value.
abstract int
getNetworkTypePreference()
Returns the current network type preference value.
abstract boolean
isRoamingAllowed()
Returns the current roaming preference value.
abstract void
setBatteryUsagePreference(int batteryUsagePreference)
Sets the battery usage preference to be applied on operations performed by the calling application.
abstract void
setNetworkTypePreference(int networkTypePreference)
Sets the network type preference to be applied on operations performed by the calling application.
abstract void
setRoamingAllowed(boolean allowRoaming)
Sets whether the operations by the calling application are allowed while the device is on roaming.

Constants

public static final int BATTERY_USAGE_CHARGING_ONLY

This value signifies that the operations by the calling application are allowed only when the device is plugged into a power source. Note that this restriction is applied in addition to the network type preferences, see getNetworkTypePreference().

Constant Value: 257

public static final int BATTERY_USAGE_UNRESTRICTED

This value signifies that the operations by the calling application are allowed immediately without being restricted on the current battery status of the device. Note that this restriction is applied in addition to the network type preferences, see getNetworkTypePreference().

Constant Value: 256

public static final int NETWORK_TYPE_ANY

This value signifies that the operations by the calling application are not restricted to any specific network type and can be applied over any available network connection (i.e. WIFI, mobile data etc). Note that this restriction is applied in addition to the battery usage preferences, see getBatteryUsagePreference().

Constant Value: 1

public static final int NETWORK_TYPE_WIFI_ONLY

This value signifies that the operations by the calling application are allowed only over a WIFI network connection. Note that this restriction is applied in addition to the battery usage preferences, see getBatteryUsagePreference().

Constant Value: 2

public static final int PREFERENCE_VALUE_UNKNOWN

This value signifies that the preference value is unknown to the calling application. This value is returned only in the case when the preference is set to a value not available in this version of the API but is added in a newer version of the API. It is advised to update to the latest version of the API to get an appropriate preference value.

Constant Value: 0

Public Methods

public abstract int getBatteryUsagePreference ()

Returns the current battery usage preference value. This value can be one of the following:

The default value for this preference is BATTERY_USAGE_UNRESTRICTED.

Note: The value PREFERENCE_VALUE_UNKNOWN will be returned only in the case when the preference is set to a value not available in this version of the API but is added in a newer version of the API. It is advised to update to the latest version of the API to get an appropriate preference value.

public abstract int getNetworkTypePreference ()

Returns the current network type preference value. This value can be one of the following:

The default value for this preference is NETWORK_TYPE_ANY.

Note: The value PREFERENCE_VALUE_UNKNOWN will be returned only in the case when the preference is set to a value not available in this version of the API but is added in a newer version of the API. It is advised to update to the latest version of the API to get an appropriate preference value.

public abstract boolean isRoamingAllowed ()

Returns the current roaming preference value. If true, operations performed by the calling application are allowed while the device is on data roaming, otherwise not. The default value for this preference is true.

public abstract void setBatteryUsagePreference (int batteryUsagePreference)

Sets the battery usage preference to be applied on operations performed by the calling application. The following battery usage preference values are allowed:

The preference value is only saved when setFileUploadPreferences(GoogleApiClient, FileUploadPreferences) is called.
Throws
IllegalArgumentException if the input is an invalid preference value.

public abstract void setNetworkTypePreference (int networkTypePreference)

Sets the network type preference to be applied on operations performed by the calling application. The following network type preference values are allowed:

The preference value is only saved when setFileUploadPreferences(GoogleApiClient, FileUploadPreferences) is called.

Note that this value does not override the system level data usage preferences (//support.google.com/nexus/answer/2819524) that the user might have set on their devices, i.e. if mobile data is disabled in the system settings, the file uploads will not happen on mobile network connection even if the file upload preference is set to NETWORK_TYPE_ANY. However, if mobile data is enabled the value set in this preference will be respected.

Throws
IllegalArgumentException if the input is an invalid preference value.

public abstract void setRoamingAllowed (boolean allowRoaming)

Sets whether the operations by the calling application are allowed while the device is on roaming. The preference value is only saved when setFileUploadPreferences(GoogleApiClient, FileUploadPreferences) is called.

Note that this value does not override the system level data usage preferences (//support.google.com/nexus/answer/2819524) that the user might have set on their devices, i.e. if data roaming is disabled in the system setting, the file uploads will not be allowed in roaming even if this preference is set to true. However if roaming is enabled, this preference will be respected.