Skip to content

Developer Documentation

Arun Sasidharan edited this page Oct 6, 2016 · 16 revisions

Developer Documentation

Gradle

The project is using the gradle build system.

Android Studio

Check out project and import it to Android Studio.

Configuration

The project uses multidex. To speed up the builds you need to set minSdkLevel to 21 and above. Our project uses minSdk property to override minSdkLevel. To do that, you should open Android Studio Compiler Settings and add a command line property like below: -PminSdk=21

Android Studio Compiler Settings

Setup Keys

local.properties file is used for storing API keys since it is already ignored in the .gitignore file.

The file looks like:

sdk.dir=
android_simple_api_access_key_debug=
android_simple_api_access_key=
ip_simple_api_access_key_debug=
ip_simple_api_access_key=
android_backup_key=
play_app_id=
gcm_sender_id=
hub_client_id=

Furthermore, you need to use the settings/debug.keystore for signing as it is whitelisted for Google Plus Sign-in. This is used by default as defined in settings/frisbee.gradle.

###play_app_id The play app id is used in the Android manifest for

  • com.google.android.gms.games.APP_ID
  • com.google.android.gms.appstate.APP_ID

If the key is missing G+ sign-in will not work. This has to come from one of the GDG-X team members after you have signed and submitted the CLA.

###android_simple_api_access_key This key is used for Google maps (com.google.android.maps.v2.API_KEY) and to initialise the YouTubePlayerSupportFragment.

Generate your developer key by creating a Cloud Console API project and then going to APIs & auth and Credentials. Then Public API access->Create new key->Android Key.

###ip_simple_api_access_key This key is used to query the G+ API.

If the key is missing most content, like G+ profile images can't be loaded.

In your Cloud Console API project, go to APIs & auth and Credentials. Then Public API access->Create new key->Server Key.

###gcm_sender_id (OPTIONAL) This id is the project id of the GDG[x] Hub.

mGcm.register(BuildConfig.GCM_SENDER_ID)

If the key is missing push notifications are not delivered. This will block the ability to log into the app unless you uncheck the GCM box when doing the initial sign in. Disabling GCM like this is recommended for most contributors.

###android_backup_key (OPTIONAL) This key is used for the backup key in the Android manifest com.google.android.backup.api_key.

If the key is missing, application backup after re-install will not work.

You can register for the Android Backup Service to get a key.

###hub_client_id The hub client it is used to get a scoped auth token. This token is send to the hub for GCM.

scope = "audience:server:client_id:" + BuildConfig.HUB_CLIENT_ID

If the key is missing push notifications are not delivered. This has to come from one of the GDG-X team members after you have signed and submitted the CLA.

###Checkstyle Integration

This project enforces a checkstyle. The checkstyle configuration is available in settings/checkstyle.xml file. Please respect to the configuration. Additionally, you can install the CheckStyle-IDEA IntelliJ plugin for realtime scanning and set it to use the above configuration.

Note: Because of the line ending difference between Unix systems and Windows, you may get checkstyle errors about line endings. If you do, please check this help page. If you cannot resolve the issue, you can simply comment out the following line in the checkstyle.xml file.

<module name="NewlineAtEndOfFile" />

###Image Optimization

Image optimization is encouraged for new images. You can use the image_optim tool to do it easily. Use the following command to install it.

gem install image_optim image_optim_pack

###Debug Build If the Game on Google Play Console is not published, only the registered testers can use the Google+ login in the debug build.

Contact a GDG-X member in Gitter to have your email added to the list of registered Play Games testers for the app.

###Build Cache (OPTIONAL) Speed up build times (including full builds, incremental builds, and instant run). Add the following line to gradle.properties:

android.enableBuildCache=true 

Note: This is currently experimental as of Android Studio 2.2

GDG-X Hub/Google Developers Groups API

Event data are received from developers.google.com.

Tagged events are received from the GDG-X Hub server.