Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
Updates the README and renames the properties file
Browse files Browse the repository at this point in the history
  • Loading branch information
Fede Fernández committed Oct 18, 2016
1 parent bd9ee87 commit 3451b87
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dist

# Keys
/debug.properties
/release.properties
/ninecards.properties
/debug.keystore
/local.properties
/modules/app/local.properties
Expand Down
150 changes: 129 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,158 @@

9 Cards does the bulk of the work for you, organizing your apps into collections. Get quick and easy access to the apps you need most

#Compile
## Prerequisites

### SBT

* [Download](http://www.scala-sbt.org/download.html) and install sbt

### Android SDK

* [Download](https://developer.android.com/studio/index.html#downloads). You only need the command line tools
* Set `ANDROID_HOME` environment variable pointing to the root folder

### Android Device

You need an Android device and [enable USB debugging](https://www.google.es/search?q=android+activate+developer+mode&oq=android+active+developer)

## Compile and Run

To compile the project:

* Install sbt
* Configure the Android SDK on your computer
* Set `ANDROID_HOME` environment variable
* Add `debug.properties` file (See [Add Debug Keys](#add-debug-keys) section)
* Clone this GitHub project to your computer

#Execute
```
$ git clone [email protected]:47deg/nine-cards-v2.git
```

From project root directory run:
* Add a `ninecards.properties` file (See [Add Debug Keys](#add-properties-file) section)

* You need to set the heap size to at least 2M

```
$ sbt
$ sbt -mem 2048
```

* Connect your phone and execute:
* Verify that your device is attached

```
> devices
```

The output should look like:

```
[info] Serial Model Battery % Android Version
[info] ---------------------- ---------------- --------- ---------------
[info] XXXXXXXXXX Nexus 6 66% 6.0.1 API 23
```

* Now you're ready to run the project, just execute:

```
> run
```

#Add Debug Keys
## Add Properties File

You need to add a `ninecards.properties` file in the project root folder.

You need to add a `debug.properties` file to the root project with the necessary keys to compile. The content should be:
This file provides some some keys for different third party services. We'll see all down bellow.

To begin with, you can use the template provided in the root folder:

```
$ cp ninecards.properties.default ninecards.properties
```
appsly.url=****
appsly.appid=****
appsly.appkey=****
google_client_id=****
google_oauth_scopes=****
crashlytics.apikey=****
crashlytics.apisecret=****

This is the content:

```
# Backend V2
backend.v2.url=
backend.v2.clientid=
# Third Parties
crashlytics.enabled=false
crashlytics.apikey=
crashlytics.apisecret=
strictmode.enabled=false
analytics.enabled=false
analytics.trackid=
# Firebase
firebase.enabled=false
firebase.url=
firebase.google.appid=
firebase.google.apikey=
firebase.gcm.senderid=
firebase.clientid=
```

#Troubleshooting
### Backend V2

These properties are mandatory.

* `backend.v2.url`: Defines the URL for the Backend. Visit the [GitHub project](https://github.com/47deg/nine-cards-backend) for more information
* `backend.v2.clientid`: This value is used by the Backend server to manage the user authentication.

To generate one you need to:

1. Go to the [Google Developers Console](https://console.developers.google.com/apis/library?project=_)
2. From the project drop-down, select a [project](https://support.google.com/cloud/answer/6158853), or create a new one.
3. Enable the Google+ API service:
1. In the list of Google APIs, search for the Google+ API service.
2. Select Google+ API from the results list.
3. Press the Enable API button.
4. When the process completes, Google+ API appears in the list of enabled APIs. To access, select API Manager on the left sidebar menu, then select the Enabled APIs tab.
4. In the sidebar under "API Manager", select Credentials.
5. In the Credentials tab, select the *Create credentials* drop-down list, and choose OAuth client ID key.
6. Select *Web application* as *Application type*
7. Enter a key Name then select Create.
8. Then copy the *client ID* of the newly generated credential

### Third Parties

These properties are optional.

**[Crashlytics](https://try.crashlytics.com/)**

* `crashlytics.enabled`: Enables or disables the Crashlytics service
* `crashlytics.apikey` & `crashlytics.apisecret`: These values are fetched from your [Crashlytics organization page](https://www.fabric.io/settings/organizations)

**[Strict Mode](https://developer.android.com/reference/android/os/StrictMode.html)**

* `strictmode.enabled`: Enables or disables the Strict Mode

**[Google Analytics](https://developers.google.com/analytics/)**

* `analytics.enabled`: Enables or disables the Google Analytics service
* `analytics.trackid`: You can use your own tracking ID. See how to [find your tracking code, tracking ID, and property number](https://support.google.com/analytics/answer/1032385)

### Google Firebase

These properties are optional. Google Firebase is used for push notifications.

**[Google Firebase](https://firebase.google.com/)**

1. Create a Firebase project in the [Firebase console](https://firebase.google.com/console/), if you don't already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, click Create New Project.
2. Add a new app in *Project Settings* -> *General*
3. Select the newly created app and download the `google-services.json`
4. Open the file in a text editor. All bellow properties are taken from this file

* `firebase.enabled`: Enables or disables the Google Firebase service
* `firebase.url`: Property `project_info.firebase_url`
* `firebase.google.appid`: Property `client[0].client_info.mobilesdk_app_id`
* `firebase.google.apikey`: Property `client[0].api_key[0].current_key`
* `firebase.gcm.senderid`: Property `project_info.project_number`
* `firebase.clientid`: Property `client[0].oauth_client[x].client_id` where x is the index of one element with `client_type` == 3

## Troubleshooting

This section contains information about possible problems compiling 9Cards

##Ubuntu: ProcessException
### Ubuntu: ProcessException

When you compile the project it's possible that you have this error:

Expand All @@ -59,7 +167,7 @@ It's a problem in 64-bit system and you need to install the `ia32-libs`. You sho

More information [here](http://stackoverflow.com/questions/22701405/aapt-ioexception-error-2-no-such-file-or-directory-why-cant-i-build-my-grad)

##Ubuntu: Launching IntelliJ from unity panel
##Ubuntu: Launching IntelliJ from unity panel

If you are using IntelliJ from unity panel it's possible that the app don't find the `ANDROID_HOME` environment variable.

Expand Down
1 change: 0 additions & 1 deletion debug.properties.default → ninecards.properties.default
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ backend.v2.clientid=
crashlytics.enabled=false
crashlytics.apikey=
crashlytics.apisecret=
stetho.enabled=false
strictmode.enabled=false
analytics.enabled=false
analytics.trackid=
Expand Down
3 changes: 1 addition & 2 deletions project/ReplacePropertiesGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ object ReplacePropertiesGenerator {
"crashlytics.enabled" -> "false",
"crashlytics.apikey" -> "",
"crashlytics.apisecret" -> "",
"stetho.enabled" -> "false",
"strictmode.enabled" -> "false",
"analytics.enabled" -> "false",
"analytics.trackid" -> "",
Expand All @@ -29,7 +28,7 @@ object ReplacePropertiesGenerator {
"firebase.gcm.senderid" -> "",
"firebase.clientid" -> "")

lazy val propertiesFileName = sys.env.getOrElse("9CARDS_PROPERTIES", "debug.properties")
lazy val propertiesFileName = sys.env.getOrElse("9CARDS_PROPERTIES", "ninecards.properties")

lazy val propertiesMap = loadPropertiesMap

Expand Down

0 comments on commit 3451b87

Please sign in to comment.