Skip to content

myTBA Configuration

Phil Lopreiato edited this page Feb 14, 2015 · 3 revisions

This page is a guide for getting set up to debug the cloud portion of the app with your own servers.

The Server

You first need a server running The Blue Alliance to test with. If you don't already have one, you can create a new Google App Engine project that you can deploy to.

  1. Go to The Google Developer Console and create a new project.
  2. Once the project is created, go into the APIs and Auth section and make sure the following APIs are enabled for your project: "Google Cloud Messaging for Android" and "Google+ API"
  3. Next, you will have to generate some credentials to use. Under APIs and Auth, go to the "Credentials" section. Here, you will need to generate 2 OAuth client IDs.
  1. Now, go a little further down the page, you will have to generate an API Access key for a Server application. In the allowed IP block, you can put 0.0.0.0/0 to allow requests from anywhere (or add in your server's static IP)

  2. Now, you can deploy the TBA Server. First, just make sure that the TBA app.yaml file contains your App Engine project ID, rather than yours (you shouldn't see tbatv-dev-hrd; replace it with your project ID if it's there). From the App Engine SDK, you can run

     ./appcfg.py --oauth2 update /path/to/tba/code 
    
  3. Now, you can go to the Sitevar page in the admin panel (http://project-id.appspot.com/admin/sitevars) and add the following sitevars:

Name Value
android.clientId The client ID you generated for the Android application in step 3
appengine.webClientId The client ID you generated for the web application in step 3
gcm.serverKey The API Key you generated in step 4

The Client Library

You next have to generate a client library that you include in the android app so it can interact with the server. You can generate the client library from the App Engine Python SDK directory by running

    ./endpointscfg.py get_client_lib java -o . -bs maven mobile_main.MobileAPI

This will output the client library in the current directory with a name like 'tbaMobilev9.zip'. You can unzip the archive and run mvn install to build the library. The output will be found in target/.

The App Part

  1. You can now copy the client library you generated into the android/libs directory of the app and modify build.gradle to include your library as a dependency (be sure to remove the dependency for the existing library (but don't forget to revert this before you commit!).
  2. Do a global find and replace project-wide (Edit->Find->Replace In Path) and replace tbatv-prod-hrd with your app engine project ID. Don't forget to revert this back before you commit, as well!
  3. If you don't have it already, create a file in android/src/main/assets called tba.properties. This is where we will store the keys we generated on the client side. Don't commit this file into the repository! It is already in .gitignore, so don't remove it.
  4. Add the following properties to tba.properties (it'll look like name=value).
Name Value
appspot.webClientId.debug The client ID you generated for the web application application earlier
appspot.androidClientId.debug The client ID you generated for the Android application earlier
gcm.senderId.debug Your App Engine project number (you can find it on the 'Overview' page of the dev console

You should now be ready to build a (debug) version of the app that uses myTBA to its fullest!

Clone this wiki locally