Skip to content

Commit

Permalink
use local.properties for api key. update versioName to 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
llopisdon committed Sep 6, 2021
1 parent ac38b26 commit b0e3e74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,10 @@ The latest DEBUG APK can be found here:

# APOD API KEY

The app looks for an APOD api key in this properties file:
The app looks for an APOD api key in the project local.properties file:

```
~/.gradle/gradle.properties
```

The api key property key/value pair should be defined as:

```
apodktm_nasa_apod_api_key=<YOUR API KEY>
nasa_apod_api_key=<YOUR API KEY>
```

If an APOD api key is not found then the demo APOD api key is used:
Expand Down
10 changes: 8 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

def localProperties = new Properties()
def localPropertiesFile = "local.properties"
if (rootProject.file(localPropertiesFile).exists()) {
localProperties.load(new FileInputStream(rootProject.file(localPropertiesFile)))
}

defaultConfig {
applicationId "com.machineinteractive.apodktm"
minSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.1.2"
versionName "1.1.3"

def apodApiKey = project.findProperty("apodktm_nasa_apod_api_key") ?: 'DEMO_KEY'
def apodApiKey = localProperties["nasa_apod_api_key"] ?: 'DEMO_KEY'
println("APOD KEY: $apodApiKey")
buildConfigField("String", "APOD_API_KEY", "\"${apodApiKey}\"")

Expand Down

0 comments on commit b0e3e74

Please sign in to comment.