Posts

Showing posts from May, 2014

GPlayServices #1: Save to Google Drive

Image
A little snippet to save a file (or some contents) in Google Drive with the Drive API included in the Google Play Services.

To use the Google Drive API we have to follow these steps:(this blog doesn't cover these topics) : Set Up Google Play Services SDKRegister your app in Google Developers Console to activate the API Now we can build our code.

First of all, we have to create an instance of GoogleApiClient using the GoogleApiClient.Builder and implementing the callback interfaces to manage the connection and the authorizations as described in GPlay Service #0.

Our scope is to save a file (an image) choosing a folder in Google Drive.

To choose a folder inside our Google Drive we can use the Drive.DriveApi.newOpenFileActivityBuilder().
This method creates a builder for an Open File activity that allows user selection of a Drive file. Upon completion, the result Intent will contain the DriveId for the selected file.

We can use the OnConnected interface to know when the connect requ…

GPlayServices #0: Configure the GoogleApiClient with Google Play Services.

Image
A little snippet to connect your app with the Google Play Services API.

To use the Google Play Services API you have to follow these steps:(this blog doesn't cover these topics) : Set Up Google Play Services SDKRegister your app in Google Developers Console to activate the API Now you can build your code.

First of all, create an instance of GoogleApiClient using the GoogleApiClient.Builder. /** * Called when activity gets visible. A connection to Drive services need to * be initiated as soon as the activity is visible. Registers * {@code ConnectionCallbacks} and {@code OnConnectionFailedListener} on the * activities itself. */ @Override protected void onResume() { super.onResume(); if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .addScope(Drive.SCOPE_APPFOLDER) …

Integrating an Android Github repo with Travis Ci with the new Android Plugin

In my previous post I wrote how to integrate an Android Github repo with Travis Ci.

Now we can change something in our travis.yml, using the new Android plugin.
Warning:The features described here are still in development!

All the considerations described in the old post remain valid, but we can update some parts.
First, declare the new language: language: android With this line, travis provides the Android SDK 22.6.2 with following preinstalled components: platform-toolsandroid-19sysimg-19 (ARM)android-18sysimg-18 (ARM)android-17sysimg-17 (ARM)android-16sysimg-16 (ARM)android-15sysimg-15 (ARM)android-10extra-android-supportextra-google-google_play_servicesextra-google-m2repositoryextra-android-m2repository Here you can find the updated list.

Then we can add or update(a.k.a. re-install) some components to get the latest minor versions:
android: components: - build-tools-19.0.3 Under the wood the plugin runs the command:
android update sdk --no-ui --all --filter "component-…