Skip to content
Permalink
Browse files
docs: removes reference to deprecated service (Google+) (#1530)
  • Loading branch information
danoscarmike committed Jun 3, 2020
1 parent 9d11712 commit b2572075418dbbb86b9da8901184c72966464520
Showing with 21 additions and 14 deletions.
  1. +19 −9 docs/android.md
  2. +2 −5 docs/errors.md
@@ -8,7 +8,7 @@ If you are developing for Android and the Google API you want to use is included
in the [Google Play Services library][play-services], use that library for the
best performance and experience.

To access other Google APIs, use the Google Client Library for Java's
To access other Google APIs, use the Google APIs Client Library for Java's
Android-specific helper classes, which are well-integrated with
[Android AccountManager][account-manager].

@@ -51,19 +51,29 @@ fields are returned to you in the HTTP response. This can significantly reduce
the size of the response, thereby reducing network usage, parsing response time,
and memory usage. It works with both JSON and XML.

The following snippet of code drawn from the Google+ Sample demonstrates how to
use the partial-response protocol:

The following snippet of code drawn from the [Google Drive API Quickstart][quickstart]
demonstrates how to use the partial-response protocol. The `setFields` method
identifies the fields you want returned:

```java
Plus.Activities.List listActivities = plus.activities().list("me", "public");
listActivities.setMaxResults(5L);
// Pro tip: Use partial responses to improve response time considerably
listActivities.setFields("nextPageToken,items(id,URL,object/content)");
ActivityFeed feed = listActivities.execute();
// Print the names and IDs for up to 10 files.
FileList result = service.files().list()
.setPageSize(10)
.setFields("nextPageToken, files(id, name)")
.execute();
List<File> files = result.getFiles();
if (files == null || files.isEmpty()) {
System.out.println("No files found.");
} else {
System.out.println("Files:");
for (File file : files) {
System.out.printf("%s (%s)\n", file.getName(), file.getId());
}
}
```

[play-services]: https://developer.android.com/google/play-services/index.html
[account-manager]: http://developer.android.com/reference/android/accounts/AccountManager.html
[http-client-android]: https://github.com/googleapis/google-http-java-client/wiki/Android
[oauth2-android]: https://github.com/googleapis/google-api-java-client#oauth2-android
[quickstart]: https://developers.google.com/drive/api/v3/quickstart/java
@@ -33,14 +33,12 @@ When an error status code is detected in an HTTP response to a Google API that
uses the JSON format, the generated libraries throw a
[`GoogleJsonResponseException`][google-json-response-exception].
The errors use the format specified in [Error responses][error-responses].
The following example shows one way that you can handle these exceptions:
```java
Plus.Activities.List listActivities = plus.activities().list("me", "public");
Drive.Files.List listFiles = drive.files.list();
try {
ActivityFeed feed = listActivities.execute();
FileList response = listFiles.execute();
...
} catch (GoogleJsonResponseException e) {
System.err.println(e.getDetails());
@@ -49,4 +47,3 @@ try {
[google-analytics-api]: https://developers.google.com/analytics/
[google-json-response-exception]: https://googleapis.dev/java/google-api-client/latest/com/google/api/client/googleapis/json/GoogleJsonResponseException.html
[error-responses]: https://developers.google.com/url-shortener/v1/getting_started?csw=1#errors

0 comments on commit b257207

Please sign in to comment.