I was wondering if there was a way to detect if the program is running on the default (debug) keystore (when running from eclipse) or on a signed keystore (when released to Android market)
I use Google Maps in my application and I would like programmatically change the Maps API key appropriately for testing and release since the one API key only works for either testing or release.
There must be a way to do this since Google Maps can detect what keystore was used to compile the application (to enable or disable the maps).
http://daniel-codes.blogspot.com/2011/04/detecting-keystore-signature-in-code.html
This seems like an appropriate method to identify release keys
Also
http://whereblogger.klaki.net/2009/10/choosing-android-maps-api-key-at-run.html
Also
Android: automatically choose debug/release Maps api key?
I don't know how Google Maps does its thing, but here's a possible alternative: You can use the package manager to pull the certificate used to sign the APK and compare it to your known release keystore. I suggest comparing it to this rather than your debug keystore because the debug store expires yearly; your release store will not expire for quite a long time (if you followed Google's guidelines).
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