| 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 |
API to retrieve 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 |
API to retrieve a list of |
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(GetMobileDeviceRequest request)
public final MobileDevice getMobileDevice(GetMobileDeviceRequest request)API to retrieve 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(MobileDeviceName name)
public final MobileDevice getMobileDevice(MobileDeviceName name)API to retrieve 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 |
MobileDeviceNameRequired. The resource name of the MobileDevice. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDevice |
|
getMobileDevice(String name)
public final MobileDevice getMobileDevice(String name)API to retrieve 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()API to retrieve 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 MobileDeviceServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
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(ListMobileDevicesRequest request)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(ListMobileDevicesRequest request)API to retrieve a list of 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(NetworkName parent)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(NetworkName parent)API to retrieve a list of 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 |
NetworkNameRequired. The parent, which owns this collection of MobileDevices. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileDeviceServiceClient.ListMobileDevicesPagedResponse |
|
listMobileDevices(String parent)
public final MobileDeviceServiceClient.ListMobileDevicesPagedResponse listMobileDevices(String parent)API to retrieve a list of 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()API to retrieve a list of 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()API to retrieve a list of 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()