Just finished coding an Android app and am preparing to release it to the Play Store. During development, I obtained a Google Maps API Key using my debug.keystore, and placed this key in my Manifest, like so:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_API_KEY" />
However, I've now signed my app with my release certificate, and thus got a new API key from Google Maps. For testing purposes, is there a way to keep both the old (debug) and new (release) API key in my Manifest, with a switch that loads the proper one at run time? Ex:
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" />
}
Cheers!
You may use the same key for multiple signing keys or even multiple applications.
On the API Console edit allowed apps and add SHA;package pairs, one pair per line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With