DeviceReference
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
DeviceReference
là một mô hình trừu tượng API cho phép bạn cung cấp một đối số device cho một phương thức bằng cách sử dụng một trong các loại giá trị nhận dạng sau:
- Mã tài nguyên API dạng số.
- Mã phần cứng thực tế, chẳng hạn như số IMEI, thuộc về thiết bị được sản xuất.
Các phương thức hoạt động trên thiết bị lấy DeviceReference
làm loại tham số vì loại tham số này linh hoạt hơn đối với phương thức gọi. Để tìm hiểu thêm về mã nhận dạng thiết bị, hãy đọc phần Giá trị nhận dạng.
Biểu diễn dưới dạng JSON |
{
// Union field device can be only one of the following:
"deviceId": string,
"deviceIdentifier": {
object (DeviceIdentifier )
}
// End of list of possible types for union field device .
} |
Trường |
Trường kết hợp device . Bắt buộc. Giá trị nhận dạng duy nhất của thiết bị. device chỉ có thể là một trong những trạng thái sau đây: |
deviceId |
string (int64 format)
Mã của thiết bị.
|
deviceIdentifier |
object (DeviceIdentifier )
Mã phần cứng của thiết bị.
|
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["`DeviceReference` allows methods to accept a device argument using either a numeric API resource ID or real-world hardware IDs."],["Methods use `DeviceReference` as a parameter for flexibility in identifying devices."],["The `device` field in the JSON representation is a union field, accepting either a `deviceId` or `deviceIdentifier`."],["`deviceId` is a string that represents the unique ID of the device, and `deviceIdentifier` refers to an object containing the hardware IDs."]]],["A `DeviceReference` is used as a device argument in methods, accepting either a numeric API resource ID (`deviceId`) or real-world hardware IDs (`deviceIdentifier`) like IMEI. The JSON representation uses a union field named `device` that contains either a `deviceId` string (int64 format) or a `deviceIdentifier` object, which holds the device's hardware IDs. Methods use this type for increased flexibility in identifying devices.\n"]]