Repository navigation
Expand file tree
/
Copy pathinstructions.html
More file actions
138 lines (123 loc) · 5.35 KB
/
Copy pathinstructions.html
File metadata and controls
138 lines (123 loc) · 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<html>
<title>tasks-android-sample</title>
<body>
<h2>Instructions for the Tasks V1 Android Sample</h2>
<h3>Browse Online</h3>
<ul>
<li><a
href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/tasks-android-sample">Browse
Source</a>, or main file <a
href="http://code.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples">TasksSample.java</a>
</li>
</ul>
<h3>Register Your Application</h3>
<p>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:</p>
<pre>
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1
Enter keystore password: android
</pre>
<p> And for the release build: </p>
<pre>
keytool -exportcert -alias androiddebugkey -keystore my-release-key.keystore | openssl sha1
</pre>
<p>Next, register in the Google APIs Console:</p>
<ul>
<li>Visit the <a
href="https://code.google.com/apis/console/">Google apis
console</a> </li>
<li>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"</li>
<li>Click on "Services", and change the Tasks API status to "ON".</li>
<li>Click on "API Access", and then on "Create an OAuth 2.0 Client
ID...".</li>
<li>Enter a product name and click "Next".</li>
<li>Select "Installed application", select "Android", enter
com.google.api.services.samples.tasks.android for "Package name".
<ul><li><b>Note:</b> 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. </li></ul></li>
<li>Paste the SHA1 fingerprint for the debug certificate above into "Signing
certificate fingerprint (SHA1)", and click "Create client ID".</li>
<li>Click "Create another client ID..." and follow the directions
from the previous steps, but use the release certificate instead of the
debug certificate.</li>
</ul>
<h3>Checkout Instructions</h3>
<p>
<b>Prerequisites:</b> install <a href="http://java.com">Java 6</a>, <a
href="http://mercurial.selenic.com/">Mercurial</a> (requires 1.6 or
higher). You may need to set your
<code>JAVA_HOME</code> and <code>ANDROID_HOME</code>.
</p>
<pre>
cd <i>[someDirectory]</i>
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
cd google-api-java-client-samples/tasks-android-sample
</pre>
<p>To enable logging of HTTP requests and responses (highly recommended
when developing):</p>
<pre>
adb shell setprop log.tag.HttpTransport DEBUG
</pre>
<h3>Setup Project in Eclipse</h3>
<p>
<b>Prerequisites:</b> install <a href="http://www.eclipse.org/downloads/">Eclipse</a>,
the <a href="http://javaforge.com/project/HGE">Mercurial plugin</a> (optional), and the <a
href="http://developer.android.com/sdk/eclipse-adt.html#installing">Android
plugin</a>.
</p>
<ul>
<li>Preferences:
<ul>
<li>Android: setup SDK location</li>
</ul>
</li>
<li>Window > Android SDK Manager
<ul>
<li>Check on "Google APIs" under "Android 4.1.6 (API Level 16)"</li>
<li>Check on "Google Play services" under "Extras".</li>
<li>Click on "Install X packages..."</li>
</ul>
</li>
<li>Import <code>tasks-android-sample</code> project
<ul>
<li>File > Import...</li>
<li>Select "General > Existing Project into Workspace" and click
"Next"</li>
<li>Click "Browse" next to "Select root directory", find <code>
<i>[someDirectory]</i>/google-api-java-client-samples/tasks-android-sample
</code> and click "Next"
</li>
<li>Click "Finish"</li>
</ul></li>
<li>Set up the Google Play Services SDK by following the instructions under "Setup":
<ul><li><a href="http://developer.android.com/google/play-services/setup.html">
http://developer.android.com/google/play-services/setup.html</a></li></ul></li>
<li>Clean Project (if compile error about missing gen directory)
<ul>
<li>Select <code>tasks-android-sample</code> project</li>
<li>Project > Clean...</li>
<li>Select "Clean projects selected below"</li>
<li>Click on "OK"</li>
</ul>
</li>
<li>NOTE: you must use a physical device for developing and testing
because Google Play services cannot be installed on an emulator.
<a href="http://developer.android.com/training/basics/firstapp/running-app.html#RealDevice">
Read this page</a> for more information on how to set up a device with Eclipse.</li>
<li>Run
<ul>
<li>Right-click on project tasks-android-sample</li>
<li>Run As > Android Application</li>
<li>Select the physical device and click OK.</li>
</li>
</ul>
</li>
</ul>
</body>
</html>