Allow the API key to be customized per-environment with local.properties

It will default to ge0rg's production signing key if it's not included
in local.properties
pull/280/head
Loren M. Lang 2020-08-30 11:51:38 -07:00
rodzic 5b39c442e4
commit 52a63a489f
1 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -57,6 +57,16 @@ def versionCodeDate() {
return new Date().format("yyyyMMdd00").toInteger()
}
}
def mapsApiKey() {
Properties properties = new Properties()
try {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
} catch(Exception ex) {}
// the default google_maps_key is restricted to ge0rg's signing keys and can't be used by other builds!
properties.getProperty('mapsApiKey', "AIzaSyA12R_iI_upYQ33FWnPU_8GlMKrEmjDxiQ")
}
android {
compileSdkVersion 28
defaultConfig {
@ -68,8 +78,7 @@ android {
resValue "string", "build_date", "$build_date"
resValue "string", "build_version", "$build_version"
// the google_maps_key is restricted to ge0rg's signing keys and can't be used by other builds!
resValue "string", "google_maps_key", "AIzaSyA12R_iI_upYQ33FWnPU_8GlMKrEmjDxiQ"
resValue "string", "google_maps_key", mapsApiKey()
}
useLibrary 'org.apache.http.legacy'
compileOptions {