On Wed, Oct 24, 2012 at 12:19 PM, Jason Hsu <jhsu802...@gmail.com> wrote:

> When I published the first version of my app, the map display in my Google
> Play app didn't work even though it did work when I ran my app from source
> code.  So I had to change the API key in the source code and republish my
> app, and Google Maps did work in my second version.  However, Google Maps
> didn't work when I ran my app from source code.
>

You were probably first using your debug key then your release key.


> Given this conundrum, is there a way I can use the same API key for both
> developing AND publishing apps?
>

No. The key is derived from the signing key for the app, which is the
default debug key in debug / dev mode and your signing key when you publish.

What I do is determine the map key at run time based on the build type and
initialize the MapView with that.

Something like this:

String mapKey = isDebug() ? DEBUG_KEY : RELEASE_KEY;
MapView view = new MapView(mapKey);

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to