/** * Construct a Censusapi instance to connect to the Censusapi service. * * @param transport The transport to use for requests * @param jsonHttpRequestInitializer The initializer to use when creating an JSON HTTP request * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} * @param jsonFactory A factory for creating JSON parsers and serializers * @param baseUrl The base url of the service on the server * @param applicationName The application name to be sent in the User-Agent header of requests */ Censusapi( HttpTransport transport, JsonHttpRequestInitializer jsonHttpRequestInitializer, HttpRequestInitializer httpRequestInitializer, JsonFactory jsonFactory, String baseUrl, String applicationName) { super(transport, jsonHttpRequestInitializer, httpRequestInitializer, jsonFactory, baseUrl, applicationName); }
/** * Construct a Articlesapi instance to connect to the Articlesapi service. * * @param transport The transport to use for requests * @param jsonHttpRequestInitializer The initializer to use when creating an JSON HTTP request * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} * @param jsonFactory A factory for creating JSON parsers and serializers * @param baseUrl The base url of the service on the server * @param applicationName The application name to be sent in the User-Agent header of requests */ Articlesapi( HttpTransport transport, JsonHttpRequestInitializer jsonHttpRequestInitializer, HttpRequestInitializer httpRequestInitializer, JsonFactory jsonFactory, String baseUrl, String applicationName) { super(transport, jsonHttpRequestInitializer, httpRequestInitializer, jsonFactory, baseUrl, applicationName); }
/** * Construct a Bestsellingbooksapi instance to connect to the Bestsellingbooksapi service. * * @param transport The transport to use for requests * @param jsonHttpRequestInitializer The initializer to use when creating an JSON HTTP request * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} * @param jsonFactory A factory for creating JSON parsers and serializers * @param baseUrl The base url of the service on the server * @param applicationName The application name to be sent in the User-Agent header of requests */ Bestsellingbooksapi( HttpTransport transport, JsonHttpRequestInitializer jsonHttpRequestInitializer, HttpRequestInitializer httpRequestInitializer, JsonFactory jsonFactory, String baseUrl, String applicationName) { super(transport, jsonHttpRequestInitializer, httpRequestInitializer, jsonFactory, baseUrl, applicationName); }
@Override public List<Activity> loadInBackground() { mIsLoading = true; // Set up the HTTP transport and JSON factory HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); JsonHttpRequestInitializer initializer = new GoogleKeyInitializer( Config.API_KEY); // Set up the main Google+ class Plus plus = Plus.builder(httpTransport, jsonFactory) .setApplicationName(Config.APP_NAME) .setJsonHttpRequestInitializer(initializer) .build(); ActivityFeed activities = null; try { activities = plus.activities().search(mSearchString) .setPageToken(mNextPageToken) .setMaxResults(MAX_RESULTS_PER_REQUEST) .execute(); mHasError = false; mNextPageToken = activities.getNextPageToken(); } catch (IOException e) { e.printStackTrace(); mHasError = true; mNextPageToken = null; } return (activities != null) ? activities.getItems() : null; }
@Override public Builder setJsonHttpRequestInitializer( JsonHttpRequestInitializer jsonHttpRequestInitializer) { super.setJsonHttpRequestInitializer(jsonHttpRequestInitializer); return this; }