Commit 09b1f161 authored by Romain Hunault's avatar Romain Hunault
Browse files

Add a default OWM key during build

parent abb8ff53
......@@ -6,6 +6,7 @@ stages:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- sed -i -e 's/<string name="default_key"><\/string>/<string name="default_key">'${DEFAULT_OWM_KEY}'<\/string>/g' app/src/main/res/values/strings.xml
......@@ -68,7 +68,7 @@ public class OpenWeatherMapProviderService extends WeatherProviderService
final SharedPreferences preferences
= PreferenceManager.getDefaultSharedPreferences(this);
final String mApiId = preferences.getString(API_KEY, null);
final String mApiId = preferences.getString(API_KEY, getString(R.string.default_key));
......@@ -146,7 +146,7 @@ public class OpenWeatherMapProviderService extends WeatherProviderService
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(API_KEY)) {
Logging.logd("API key has changed");
final String mApiKey = sharedPreferences.getString(key, null);
final String mApiKey = sharedPreferences.getString(key, getString(R.string.default_key));
......@@ -37,4 +37,6 @@
<string name="prefscreen_disclaimer_summary">The information provided by this application is provided for general information purposes only</string>
<string name="copyright_title">Copyright</string>
<string name="copyright_summary">OpenWeatherMap is a registered trademark of OpenWeatherMap Inc, both in the United States and internationally</string>
<string name="default_key"></string>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment