aboutsummaryrefslogtreecommitdiff
path: root/doc/BUILDING.md
blob: 8f966335e957d70b043341086ee309c20eb5c86a (plain)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
    Copyright 2014 Google Inc. All rights reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

# How to build IOSched

This is a Gradle-based project that works best with [Android Studio].

<hr>  
> __Note I__: While the instructions below allow you to build IOSched, much of 
    the functionality that depends on server APIs won't work because in order to
    do that you need to configure your own project in Google Developer
    Console (create API keys, etc). These additional steps required to set up, 
    are outlined in the [Server side setup] section in this document.

> __NOTE II__: If you NOT wish to build with Android Wear support, further 
    details can be found in the [Building without Android Wear] section in this 
    document.  
	
<hr> 

## Building the app

1. Install the following software:
       - Android SDK:
         http://developer.android.com/sdk/index.html
       - Gradle:
         http://www.gradle.org/downloads
       - Android Studio:
         http://developer.android.com/sdk/installing/studio.html

2. Run the Android SDK Manager by pressing the SDK Manager toolbar button
   in Android Studio or by running the `android` command in a terminal
   window.

3. In the Android SDK Manager, ensure that the following are installed,
   and are updated to the latest available version:
       - Tools > Android SDK Platform-tools (rev 21 or above)
       - Tools > Android SDK Tools (rev 23.0.5 or above)
       - Tools > Android SDK Build-tools version 20
       - Tools > Android SDK Build-tools version 21 (rev 21.0.2 or above)
       - Android 4.4W2 > SDK Platform (API 20)
       - Android 5.0 > SDK Platform (API 21)
       - Extras > Android Support Repository
       - Extras > Android Support Library
       - Extras > Google Play services
       - Extras > Google Repository

4. Create a file in your working directory called local.properties,
   containing the path to your Android SDK. Use local.properties.example as a
   model. _(On Windows, use a double-backslash (`\\`) as a path separator!)_

5. Import the project in Android Studio:

    1. Press File > Import Project
    2. Navigate to and choose the settings.gradle file in this project
    3. Press OK

6. Add your debug keystore to the project (save it as android/debug.keystore),
    or modify the build.gradle file to point to your key.

    > __NOTE__: In debug mode, you sign your app with a debug certificate 
        generated by the Android SDK. _(This certificate has a private key and a
        known password.)_ To sign your app in release mode, you need to generate
        your own certificate. If you haven't done so yet, please refer to the
        [App Signing] guide for further details. Also, if you wish to build with 
        Android Wear support, for further details please refer to the guide
        [Packaging Wearable Apps].

7. Choose Build > Make Project in Android Studio or run the following
    command in the project root directory:  
   ```sh
    ./gradlew clean assembleDebug
   ```  

8. To install on your test device:  
   ```sh
    ./gradlew installDebug
   ```  

## Building without Android Wear

If you do NOT wish to build the Android Wear component, you need to make the two
changes below.  

  1. Open android/build.gradle and remove (or comment out) the following line:  
    ```
         wearApp project(":Wearable")
    ```
  2. Open settings.gradle and remove `':Wearable'`, leaving only `':android'`.

# Server-side setup

> __NOTE__: These steps are optional, in the sense that IOSched will build and 
    run even if you don't set up the server side. However, unless you perform 
    this setup, your build won't be able to use any of the Google APIs such as 
    Google sign in, Google Drive integration, Google Maps integration, etc. So 
    following the instructions in this section is highly recommended.

1. Change the project's package name to your own package name. To do that, you
can set the "package" attribute of the <manifest> tag in AndroidManifest.xml.

2. Create a project in the Google Developers Console, at
     https://cloud.google.com/console

3. Note your project's Project ID. It is a 11-12 digit sequence that appears in
the URL; indicated by ########### below:
    ```
    https://console.developers.google.com/project/###########/...
    ```
    Write down this project ID number you will need it soon.

4. Navigate to "APIs and auth" > "APIs" and enable all of the following APIs:
    - Drive API
    - Google Cloud Messaging for Android
    - Google Maps Android API v2
    - Google+ API
    - YouTube Data API v3

5. Navigate to "APIs and auth" > "Credentials" and create a new Client ID for
Android applications with the package name (as defined in AndroidManifest.xml in
Step 1) and your debug certificate fingerprint. As a reminder, to get your debug
certificate fingerprint, run the following command (on Windows, substitute
`%USERPROFILE%` for `$HOME`):
    ```sh
    keytool -exportcert -alias androiddebugkey \
        -keystore $HOME/.android/debug.keystore -list -v
    ```
    It's also advisable to create a 2nd Client ID corresponding to your release
    certificate as well. To get your release certificate's fingerprint, run:
    ```sh
    keytool -exportcert -alias your-key-name \
        -keystore /path/to/your/release/keystore/file -list -v
    ```
    > __NOTE__: In order to create a Client ID, you might be required to set up 
        the consent screen first! _(That's the screen that will be shown to 
        users whenever you request access to their private data using your 
        Client ID.)_ To do so, go to "APIs and auth" > "Consent screen", enter a
        "PRODUCT NAME" and click "Save". Finally, go back to Step 5 to create 
        your Client ID(s).

6. Still at the "Credentials" page, create an API Key for Public API access.
As a key type use _"Key for Android applications"_, and you should add both your
debug and release certificate fingerprints in the list of accepted certificates.
Note the API key you created. _(It's a long alphanumeric string that may contain
digits, letters and underscores.)_

7. Enter the API key from Step 6 into this file:  
    ```
    android/src/main/res/values/maps_api_key.xml
    ```
8. Enter the API key from Step 6, as a value for the `YOUTUBE_API_KEY` constant,
   into this file:  
    ```
    android/src/main/java/com/google/samples/apps/iosched/Config.java
    ```

<hr>

Done. IOSched should now work with Google sign in, Google Drive and Maps
integration. Note that we did NOT include setting up GCM. For more information
about this, see the [CUSTOM.md] file.


[Android Studio]:http://developer.android.com/sdk/installing/studio.html
[App Signing]:http://developer.android.com/tools/publishing/app-signing.html#studio
[Building without Android Wear]:https://github.com/google/iosched/blob/master/doc/BUILDING.md#building-without-android-wear
[CUSTOM.md]:https://github.com/google/iosched/blob/master/doc/CUSTOM.md
[Packaging Wearable Apps]:http://developer.android.com/training/wearables/apps/packaging.html
[Server side setup]:https://github.com/google/iosched/blob/master/doc/BUILDING.md#server-side-setup