I generated MD5 and SHA fingerprint for my android application. Then I went to google to get an map api for android with SHA. Because I havent seen any place in google to get api with MD5. Even I set INTERNET permission in manifest file and define my layout as below ,google map is not seen in my activity
<com.google.android.maps.MapView
android:id="#+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyCfaFYAg1ql6hHN..."
Furthermore I saw in a article that if I get api key with SHA fingerprint it will not work. But Google asks for only SHA for api key.
if the map is not showing up then it is something with your key. You need 2 different keys, one for when you debug and one for when you release to the market
Let me answer my question which I was expecting to get a solution from SO society.
Be sure you have installed Google Play servise
Then get the google-play-services_lib from C:\Program
Files\adt-bundle-windows-x86_64-20130219\sdk\extras\google\google_play_services\libproject\google-play-services_lib
as Android Project From Existing Code into your workspace
Add this to your project Library as
(Project->Properties->Android->Library->Add)
And then all you need to complete using google map in your app is
getting a key from google. Just enough to follow instructions at the
bottom of Creating an API Project at https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
That's all. have fun with SO
Related
Need help , tired of following the tutorials but still no results. I am using android studio and trying to make map app. Tried using the map template in studio as it is just by entering my key bt no matter what i do , i get the same results, blank screen with google log. Google maps console shows zero request from my key to accces maps.
you must add api key, for this need register your application in the Google Developers Console
https://developers.google.com/maps/documentation/android/start
For starters, you need to create a project on Google Devlopers Console.
See this tutorial.
Thank you devs for support but I solved my problem myself by digging whole day , after implementing maps layout activity and manifest and other required files , the app should be build with the keystore provided in android sdk itself instead of our own keystore. keystore path - C/user/{username}/.android/debug.keystore with alias as "androiddebugkey" and password as "android".
I recently changed my hard drive to my Pc and when I clone my project from github and add the google-play-services as a library I tried to open the google maps and I didn't get any error but nothing shown up. I can see only the zoom buttons and the my location icon. Do I have to regenerate the google-map-api-key for the new ssd?
Yes you need to get your currently generated key from debug.keystore folder and register it via the Google API Console, here is a blog post I wrote on how to do just that:
Generating Google Map API V2 key
Probably you'll have to regenerate your maps API key, as I gues you have a new certificate on your new hard drive. Use keytool to do that, like here:
https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
I had an android application that utilizes google maps.
I have followed the instuctions and made the app working in debug mode using the debug key.
I have retrieved my SHA-1 key from the debug.keystore found here.
c:\Users\myself\.android\debug.keystore
using
c:\Program Files\Java\jdk1.7.0_03\bin>keytool -list -v -keystore c:\debug.keystore
The map was showing fine whenever I used tethered debug by running the app from eclipse on my test phone (which ran android 2.3.6).
However, after finishing the app, in the published app the map did not show. What was visible were only grey tiles.
I know this is an issue with the API key.
So I created a new key, (and an apk with it) used it to generate a new API key from the google's console. I deleted the apk that was generated with the key, as it had the old ApiKey, and pasted the new api key here.
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:id="#+id/mymap"
android:apiKey="my_api_key"
Then I re exported my project but this time used the same key that I had created the step before as they contained the same SHA-1.
However, still the map does not show and only grey tiles appear.
I have entered my SHA-1 key in the api console in the following way.
18:3E:1D:8C:xx:xx:xx:xx:xx:xx:xx:xx:xx:x:xx:1D:E1:08:32:8E;com.mycompany.mapapp
I tried to revert back to my debug key, but this time the debug app (running from eclipse) also did not show any maps.
my questions are the following.
Is this still the correct method to use? Because in the --https://developers.google.com/maps/documentation/android/start#obtaining_an_api_key -- google used different approach using fragments.
What am I missing ?
Is this method deprecated or should work ?
You're generating an ApiKey for the Google Maps V2, but you are using the v1 MapView com.google.android.maps.MapView.
On the Android Maps V2 API, the key is placed on the manifest, and you use com.google.android.gms.maps.MapView to show the map, using the Google Play Services Library.
I suggest reading the overview section here to learn how to setup your Project with the Google Play Services Library, and looking at the new API Reference here.
If you are developing google maps api. You need to have two sets of map api key. One map api key that is generated by using your SHA1 fingerprint from your debugging keystore, this map api key is to be used when you are debugging your app in eclipse and running it from there. The other map api key is generated by using your SHA1 fingerprint from official or production keystore, this map api key is used when you will signed or publish your app.
I think you are experiencing mismatch of your keys there since the map api key on the manifest is from debugging keystore and you have signed your app with your official keystore.
Also I think you are developing MapView. It is recommended now to use MapFragments now. I have links here that might help you.
Quick Start Guide: https://docs.google.com/document/d/1dFzZT0C782BxLkDIUEb711rmsbMmYPURFV_2Cdb36so/edit?usp=sharing
Trouble shooting thread if you encounter problems with MapFragment or Google Play Services Library:
Unable instantiate android.gms.maps.MapFragment
Also I have answers here in this How to/Error in declaring google-play-services-component that might help you.
Both in eclipse and when uploaded to Play Store the app just shows the grey grid and the custom markers I added but the actual map is not shown.
I am using the keys from the previous developer before me and the previous versions seem to work on Google Play but when I build it it fails to show the map.
Can anyone help me with this?
Only two reasons this would ever happen:
Your device does not have an internet connection or is otherwise unable to download the map tiles because of a firewall on your network etc.
You are using an API key for the maps library that doesn't match the certificate you are signing the apk with. Remember that Eclipse signs the apk with a debug key, and you use a different key for publishing. See this documentation for details on this.
Google Maps API key is connected to they keystore, you should ask the previous developer for the keystore and export your APK with it. Otherwise, you follow the steps in this post and when you get the MD5 fingerprint you sign up here to get new Google Maps API key.
I have done one project in android which is to display map using GOOGLE API KEY.
goto: [http://mobiforge.com/developing/story/using-google-maps-android]
I generated MAP API key for my system by following the procedure mentioned in above link correctly. It works well and displays map on EMULATOR.
I took a BUILD of my project and uploaded into my android MOBILE. Here Map DOESN'T display on my mobile. But all other functions work well.
Don't know what is the reason behind this problem :(
My AVD Version Details:
AVD Name: Google APIs(Google Inc.)
Platform : 2.1
API Level: 7
My android Mobile Details:
It also supports GoogleAPI 2.1(Level 7) only.
All other functionalities work well except displaying map.
(I am getting Polylines only)
My XML file looks:
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ"
/>
Can anyone help me to recover this problem?
Thanks in advance!
So while it's not really possible for us to know if you are using the correct key, remember that the Map API key is tied to the keystore that signed the apk. I suspect that on your emulator there is a debug keystore being used. This is the one that is probably used as you do your work day to day.
Before you can release your application, you have to make a release build. Which means signing it with a different keystore and you need that keystore's matching Map API Key.
Check this url out for more info,
http://code.google.com/android/add-ons/google-apis/mapkey.html