Search code examples
androidgoogle-mapskeystore

Detecting debug keystore or release keystore programmatically


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).


Solution

  • 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?