com.google.android.gms.drive.FileUploadPreferences |
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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the current battery usage preference value.
| |||||||||||
Returns the current network type preference value.
| |||||||||||
Returns the current roaming preference value.
| |||||||||||
Sets the battery usage preference to be applied on operations performed by the calling
application.
| |||||||||||
Sets the network type preference to be applied on operations performed by the calling
application.
| |||||||||||
Sets whether the operations by the calling application are allowed while the device is on
roaming.
|
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()
.
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()
.
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()
.
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()
.
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.
Returns the current battery usage preference value. This value can be one of the following:
The default value for this preference isBATTERY_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.
Returns the current network type preference value. This value can be one of the following:
The default value for this preference isNETWORK_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.
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
.
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 whensetFileUploadPreferences(GoogleApiClient, FileUploadPreferences)
is called.IllegalArgumentException | if the input is an invalid preference value. |
---|
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 whensetFileUploadPreferences(GoogleApiClient, FileUploadPreferences)
is called.
Note that this value does not override the system level data usage preferences
(https://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.
IllegalArgumentException | if the input is an invalid preference value. |
---|
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 (https://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.