Just finished coding an Android application and is ready to release it in the Play Store. During development, I got the Google Maps API key using my debug.keystore and put this key in my manifest, for example:
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="MY_API_KEY" />
However, now I signed my application with my release certificate and thus received a new API key from Google Maps. For testing purposes, is there a way to save both the old (debug) and the new (release) API key in my manifest using a switch that loads the corresponding file at runtime? Example:
if (debug) { <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="DEBUG_API_KEY" /> } else if (release) { <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="RELEASE_API_KEY" /> }
Hooray!
source share