|
Android
Android environment.
READ THIS FIRST: Android development instructions (from google-http-java-client) AuthenticationThe best practice on Android (since the 2.0 SDK) is to use the AccountManager for identity management and authentication storage. OAuth 2.0Please read the details of the OAuth 2.0 flow on Android here. ClientLoginOlder Google APIs that support ClientLogin are well supported on Android. You call AccountManager.getAuthToken() with the appropriate authTokenType for the Google API you are using, for example "cl" for the Google Calendar Data API. Partial Response and UpdateGoogle APIs support partial response protocol that allows you to specify which fields should be returned to you in the HTTP response. This significantly reduces the size of the response and therefore reduces network usage, parsing response time, and memory usage. It works with both JSON and XML. Here's a snippet of code that demonstrates how to use from the Google+ Sample: 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();SamplesA good example that uses the generated service-specific library is tasks-android-sample. Another example can be found in calendar-android-sample, which mixes ClientLogin with the service-specific library. Finally, there is an example at picasa-android-sample which uses the XML-based data model. | ||