Updates the device policy. To ensure the policy is properly enforced, you need to prevent unmanaged accounts from accessing Google Play by setting the allowed_accounts in the managed configuration for the Google Play package. See restrict accounts in Google Play. When provisioning a new device, you should set the device policy using this method before adding the managed Google Play Account to the device, otherwise the policy will not be applied for a short period of time after adding the account to the device.

Scopes

You will need authorization for the https://www.googleapis.com/auth/androidenterprise scope to make a valid call.

If unset, the scope for this method defaults to https://www.googleapis.com/auth/androidenterprise. You can set the scope for this method like this: androidenterprise1 --scope <scope> devices update ...

Required Scalar Arguments

  • <enterprise-id> (string)
    • The ID of the enterprise.
  • <user-id> (string)
    • The ID of the user.
  • <device-id> (string)
    • The ID of the device.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

Device:
  android-id: string
  device: string
  latest-build-fingerprint: string
  maker: string
  management-type: string
  model: string
  policy:
    auto-update-policy: string
    device-report-policy: string
    maintenance-window:
      duration-ms: string
      start-time-after-midnight-ms: string
    product-availability-policy: string
  product: string
  report:
    last-updated-timestamp-millis: string
  retail-brand: string
  sdk-version: integer

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . android-id=magna
    • The Google Play Services Android ID for the device encoded as a lowercase hex string. For example, "123456789abcdef0".
  • device=no
    • The internal hardware codename of the device. This comes from android.os.Build.DEVICE. (field named "device" per logs/wireless/android/android_checkin.proto)
  • latest-build-fingerprint=ipsum
    • The build fingerprint of the device if known.
  • maker=voluptua.
    • The manufacturer of the device. This comes from android.os.Build.MANUFACTURER.
  • management-type=at
    • Identifies the extent to which the device is controlled by a managed Google Play EMM in various deployment configurations. Possible values include: - "managedDevice", a device that has the EMM's device policy controller (DPC) as the device owner. - "managedProfile", a device that has a profile managed by the DPC (DPC is profile owner) in addition to a separate, personal profile that is unavailable to the DPC. - "containerApp", no longer used (deprecated). - "unmanagedProfile", a device that has been allowed (by the domain's admin, using the Admin Console to enable the privilege) to use managed Google Play, but the profile is itself not owned by a DPC.
  • model=sanctus
    • The model name of the device. This comes from android.os.Build.MODEL.
  • policy auto-update-policy=sed
    • Controls when automatic app updates on the device can be applied. Recommended alternative: autoUpdateMode which is set per app, provides greater flexibility around update frequency. When autoUpdateMode is set to AUTO_UPDATE_POSTPONED or AUTO_UPDATE_HIGH_PRIORITY, autoUpdatePolicy has no effect. "choiceToTheUser" allows the device's user to configure the app update policy. "always" enables auto updates. "never" disables auto updates. "wifiOnly" enables auto updates only when the device is connected to wifi.
  • device-report-policy=amet.
    • Whether the device reports app states to the EMM. The default value is "deviceReportDisabled".
  • maintenance-window duration-ms=takimata
    • Duration of the maintenance window, in milliseconds. The duration must be between 30 minutes and 24 hours (inclusive).
  • start-time-after-midnight-ms=amet.

    • Start time of the maintenance window, in milliseconds after midnight on the device. Windows can span midnight.
  • .. product-availability-policy=duo

    • The availability granted to the device for the specified products. "all" gives the device access to all products, regardless of approval status. "all" does not enable automatic visibility of "alpha" or "beta" tracks. "whitelist" grants the device access the products specified in productPolicy[]. Only products that are approved or products that were previously approved (products with revoked approval) by the enterprise can be whitelisted. If no value is provided, the availability set at the user level is applied by default.
  • .. product=ipsum

    • The product name of the device. This comes from android.os.Build.PRODUCT.
  • report last-updated-timestamp-millis=gubergren

    • The timestamp of the last report update in milliseconds since epoch. This field will always be present.
  • .. retail-brand=lorem

    • Retail brand for the device, if set. See android.os.Build.BRAND
  • sdk-version=89
    • API compatibility version.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional Method Properties

You may set the following properties to further configure the call. Please note that -p is followed by one or more key-value-pairs, and is called like this -p k1=v1 k2=v2 even though the listing below repeats the -p for completeness.

  • -p update-mask=string
    • Mask that identifies which fields to update. If not set, all modifiable fields will be modified. When set in a query parameter, this field should be specified as updateMask=<field1>,<field2>,...

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").