| GitHub Repository | Product Reference |
Service Description: Provides methods for handling MobileDevice objects.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
MobileDeviceName name = MobileDeviceName.of("[NETWORK_CODE]", "[MOBILE_DEVICE]");
MobileDevice response = mobileDeviceServiceClient.getMobileDevice(name);
}
Note: close() needs to be called on the MobileDeviceServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetMobileDevice |
Retrieves a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListMobileDevices |
Lists |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of MobileDeviceServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MobileDeviceServiceSettings mobileDeviceServiceSettings =
MobileDeviceServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MobileDeviceServiceClient mobileDeviceServiceClient =
MobileDeviceServiceClient.create(mobileDeviceServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MobileDeviceServiceSettings mobileDeviceServiceSettings =
MobileDeviceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
MobileDeviceServiceClient mobileDeviceServiceClient =
MobileDeviceServiceClient.create(mobileDeviceServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final MobileDeviceServiceClient create()Constructs an instance of MobileDeviceServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(MobileDeviceServiceSettings settings)
public static final MobileDeviceServiceClient create(MobileDeviceServiceSettings settings)Constructs an instance of MobileDeviceServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
MobileDeviceServiceSettings |
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(MobileDeviceServiceStub stub)
public static final MobileDeviceServiceClient create(MobileDeviceServiceStub stub)Constructs an instance of MobileDeviceServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MobileDeviceServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
MobileDeviceServiceStub |
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient |
|
Constructors
MobileDeviceServiceClient(MobileDeviceServiceSettings settings)
protected MobileDeviceServiceClient(MobileDeviceServiceSettings settings)Constructs an instance of MobileDeviceServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
MobileDeviceServiceSettings |
MobileDeviceServiceClient(MobileDeviceServiceStub stub)
protected MobileDeviceServiceClient(MobileDeviceServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
MobileDeviceServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()getMobileDevice(@Nullable MobileDeviceName name)
public final MobileDevice getMobileDevice(@Nullable MobileDeviceName name)Retrieves a MobileDevice object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
MobileDeviceName name = MobileDeviceName.of("[NETWORK_CODE]", "[MOBILE_DEVICE]");
MobileDevice response = mobileDeviceServiceClient.getMobileDevice(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.MobileDeviceNameRequired. The resource name of the MobileDevice. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDevice |
|
getMobileDevice(GetMobileDeviceRequest request)
public final MobileDevice getMobileDevice(GetMobileDeviceRequest request)Retrieves a MobileDevice object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
GetMobileDeviceRequest request =
GetMobileDeviceRequest.newBuilder()
.setName(MobileDeviceName.of("[NETWORK_CODE]", "[MOBILE_DEVICE]").toString())
.build();
MobileDevice response = mobileDeviceServiceClient.getMobileDevice(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetMobileDeviceRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
MobileDevice |
|
getMobileDevice(String name)
public final MobileDevice getMobileDevice(String name)Retrieves a MobileDevice object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
String name = MobileDeviceName.of("[NETWORK_CODE]", "[MOBILE_DEVICE]").toString();
MobileDevice response = mobileDeviceServiceClient.getMobileDevice(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the MobileDevice. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDevice |
|
getMobileDeviceCallable()
public final UnaryCallable<GetMobileDeviceRequest,MobileDevice> getMobileDeviceCallable()Retrieves a MobileDevice object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
GetMobileDeviceRequest request =
GetMobileDeviceRequest.newBuilder()
.setName(MobileDeviceName.of("[NETWORK_CODE]", "[MOBILE_DEVICE]").toString())
.build();
ApiFuture<MobileDevice> future =
mobileDeviceServiceClient.getMobileDeviceCallable().futureCall(request);
// Do something.
MobileDevice response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetMobileDeviceRequest,MobileDevice> |
|
getSettings()
public final @Nullable MobileDeviceServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.MobileDeviceServiceSettings |
|
getStub()
public MobileDeviceServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listMobileDevices(@Nullable NetworkName parent)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(@Nullable NetworkName parent)Lists MobileDevice objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (MobileDevice element :
mobileDeviceServiceClient.listMobileDevices(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent, which owns this collection of MobileDevices. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient.ListMobileDevicesPagedResponse |
|
listMobileDevices(ListMobileDevicesRequest request)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(ListMobileDevicesRequest request)Lists MobileDevice objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
ListMobileDevicesRequest request =
ListMobileDevicesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (MobileDevice element :
mobileDeviceServiceClient.listMobileDevices(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListMobileDevicesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient.ListMobileDevicesPagedResponse |
|
listMobileDevices(String parent)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(String parent)Lists MobileDevice objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (MobileDevice element :
mobileDeviceServiceClient.listMobileDevices(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of MobileDevices. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient.ListMobileDevicesPagedResponse |
|
listMobileDevicesCallable()
public final UnaryCallable<ListMobileDevicesRequest,ListMobileDevicesResponse> listMobileDevicesCallable()Lists MobileDevice objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
ListMobileDevicesRequest request =
ListMobileDevicesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListMobileDevicesResponse response =
mobileDeviceServiceClient.listMobileDevicesCallable().call(request);
for (MobileDevice element : response.getMobileDevicesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListMobileDevicesRequest,ListMobileDevicesResponse> |
|
listMobileDevicesPagedCallable()
public final UnaryCallable<ListMobileDevicesRequest,MobileDeviceServiceClient.ListMobileDevicesPagedResponse> listMobileDevicesPagedCallable()Lists MobileDevice objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MobileDeviceServiceClient mobileDeviceServiceClient = MobileDeviceServiceClient.create()) {
ListMobileDevicesRequest request =
ListMobileDevicesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<MobileDevice> future =
mobileDeviceServiceClient.listMobileDevicesPagedCallable().futureCall(request);
// Do something.
for (MobileDevice element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListMobileDevicesRequest,ListMobileDevicesPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()