-
Notifications
You must be signed in to change notification settings - Fork 35
myTBA Configuration
This page is a guide for getting set up to debug the cloud portion of the app with your own servers.
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.
- Go to The Google Developer Console and create a new project.
- 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"
- 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.
- The first one is a Client ID for a web application. Use you app engine's project URL (http://project-name.appspot.com) to fill in redirect URIs (https://project-name.appspot.com/oauth2callback) and Javascript Origins (https://project-name.appspot.com).
- The second one is for an Installed Android Application. For the package name, put in the app's development package name ('com.thebluealliance.androidclient.development'). And then find the SHA1 fingerprint of your debug key and add it.
-
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)
-
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
-
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 |
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/
.
- You can now copy the client library you generated into the
android/libs
directory of the app and modifybuild.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!). - 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! - If you don't have it already, create a file in
android/src/main/assets
calledtba.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. - Add the following properties to
tba.properties
(it'll look likename=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!