Instructions for the Tasks V1 Android Sample
Register Your Application
You first need to register your Android application and sign up for
access to the Google Calendar API in the Google APIs Console. First, you
need the "Signing certificate fingerprint (SHA1)" for the debug build:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1
Enter keystore password: android
And for the release build:
keytool -exportcert -alias androiddebugkey -keystore my-release-key.keystore | openssl sha1
Next, register in the Google APIs Console:
- Visit the Google apis
- If this is your first time, click "Create project..." Otherwise, click
on the drop down under the "Google apis" logo at the top left, and click
"Create..." under "Other projects"
- Click on "Services", and change the Tasks API status to "ON".
- Click on "API Access", and then on "Create an OAuth 2.0 Client
- Enter a product name and click "Next".
- Select "Installed application", select "Android", enter
com.google.api.services.samples.tasks.android for "Package name".
- Note: The package name must be universally unique to
actually register an application. If you try
to register a package name in use, you may get an error reading "An
unexpected error has occurred." This sample has already been
registered, so you will need to change the package name.
- Paste the SHA1 fingerprint for the debug certificate above into "Signing
certificate fingerprint (SHA1)", and click "Create client ID".
- Click "Create another client ID..." and follow the directions
from the previous steps, but use the release certificate instead of the
Prerequisites: install Java 6, Mercurial (requires 1.6 or
higher). You may need to set your
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
To enable logging of HTTP requests and responses (highly recommended
adb shell setprop log.tag.HttpTransport DEBUG
Setup Project in Eclipse
Prerequisites: install Eclipse,
the Mercurial plugin (optional), and the Android
- Android: setup SDK location
- Window > Android SDK Manager
- Check on "Google APIs" under "Android 4.1.6 (API Level 16)"
- Check on "Google Play services" under "Extras".
- Click on "Install X packages..."
- File > Import...
- Select "General > Existing Project into Workspace" and click
- Click "Browse" next to "Select root directory", find
and click "Next"
- Click "Finish"
- Set up the Google Play Services SDK by following the instructions under "Setup":
- Clean Project (if compile error about missing gen directory)
- Project > Clean...
- Select "Clean projects selected below"
- Click on "OK"
- NOTE: you must use a physical device for developing and testing
because Google Play services cannot be installed on an emulator.
Read this page for more information on how to set up a device with Eclipse.
- Right-click on project tasks-android-sample
- Run As > Android Application
- Select the physical device and click OK.