Skip to content

Development Setup

Liam Niehus-Staab edited this page May 24, 2022 · 7 revisions

While contributing may not necessarily require being able to run the app, I'd say it's highly recommended, especially if you want to contribute code. This guide will attempt to do a step-by-step setup of the project from scratch. If you find a problem/missing steps with this setup, please make a PR to fix it!

1. Clone the Repository

Use git (assuming you already have git installed) to clone the repo to your desired location in your file system.

git clone https://github.com/niehusst/partyq-android.git

2. Open your IDE

You can use whatever IDE you prefer, though I highly recommend Android Studio (v3.5 or higher). Locate the partyq repository and open the project in your chosen IDE.

3. Create Secrets files

For security purposes, there are a couple of necessary/important files that I did not include in git. Telling you about their existence may decrease the security of these files a bit, but you can't do development without them... so...

The first and most important file, is partyq-android/app/src/main/jni/keys.c. This C file contains the base64 encoded Client ID and Client Secret that lets you authenticate with Spotify AppRemote and obtain OAuth tokens for the Spotify API. The file should look as follows (obviously substituting your own encoded client ID and secret):

#include <jni.h>

JNIEXPORT jstring JNICALL
Java_com_niehusst_partyq_services_KeyFetchService_00024Companion_getSpotifyClientId(JNIEnv *env, jobject instance) {
    return (*env)->  NewStringUTF(env, "your base64 encoded Spotify Client ID here");
}

JNIEXPORT jstring JNICALL
Java_com_niehusst_partyq_services_KeyFetchService_00024Companion_getSpotifyClientSecret(JNIEnv *env, jobject thiz) {
    return (*env)-> NewStringUTF(env, "your base64 encoded Spotify Client Secret here");
}

To get a Client ID and Client Secret from Spotify, you will have to have a Spotify account (it can be a free account, though a premium account will be invaluable in testing any code you write for the app). Login to their developer page with your Spotify account, and create a project. Then you should follow the Spotify Developer guide for registering your app, so that Spotify will recognize your clone of the partyq app.

Once you have your Spotify Client ID and Secret, you can convert them to base 64 in the terminal with echo "your secret thingy" | base64. Then just paste the stdout result into the string in keys.c.

The second secret file is only for if you wanted to try making a release build (however, gradle sync may require you to create it anyway in order to build). You would need to create a new .jks keystore file using either the Android Studio GUI or the keytool CLI. Then, you will have to create either a keystore.properties file containing the following info (subbing in relevant data from the keystore file you created):

PARTYQ_KEYSTORE_FILENAME=/path/to/partyq_keystore.jks
PARTYQ_KEYSTORE_PASSWORD=keystorepass
PARTYQ_KEY_ALIAS=release_alias
PARTYQ_KEY_PASSWORD=keypass

or set those same values as environment variables. If you just need to create this dummy file to sync gradle, you can populate with the dummy values provided above.

You're done!

Once you have all that set up, you should be able to build and run the app.

Clone this wiki locally