Google maps API MapView only shows grid - android

I'm trying the HelloGoogleMaps project from this official google tutorial, and I get the applicaiton running just fine, 'cept the map isn't showing; instead you can see a grid without any data. Doing some research I found that the API key could be malfunctioning; I must have done something wrong. But I dont know what it could be, as I followed the instructions given in the Google Developers Console. Here's what I did to get the key:
I clicked on Create New Key
I clicked on Android Key
I discovered the SHA1 fingerprint of my developer certificate using the following command:
keytool -list -v -keystore C:\Users\Viktor.android\debug.keystore
I copied the SHA1 certificate and pasted it as the example shows:
45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example
I got the key and placed it in res/layout/main.xml
I did make a OAuth 2.0 Client just in case, and also activated the following APIs in Google Developer's console:
Google Maps Android API v2, Google Maps Coordinate API, Google Maps Geolocation API, Google Maps JavaScript API v3, Google Maps Tracks API.
Maybe there is some conflict? Maybe its something version related?
The minimun sdk is API 10 Android 2.3.3 Gingerbread.
The target sdk is API 21 Android 4.x (L Preview), and selected Google APIs 10 to compile it.
There is a mess with the versioning, and all tutorials and solutions I find are not updated, even google tutorials refer to old versions. Anyone can point me in the right direction?
SOLUTION
Emulators won't work, as they dont have a GPS or anything, so the best thing is to use a real android device. I tried the answer below, with the genymotion thing and got no result.

Inbuilt google Emulator will not support google map. Try installing Genymotion emulator and try again.
Also API v1 is deprecated. Try going over the steps mentioned in google site for api v2 https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2

Related

google map app location doesn't show anything

I have developed an android app that uses google map ,but when I run the app the map doesn't show anything!!!
I know its a problem with my API key but i can't get it right, here is how i get it:
1) from eclipse >> window >> preferences >> android >> build then i find my SHA1 fingerprint.
2) i go to the google API COnsole and make sure i chose the google maps for android v2 is selected.
3) create new android key and pasete my SHA1 fingerprint and my package name.
please help me :)
you can download my project from link below:
https://www.dropbox.com/s/ppx4iwvpqr3wvq3/android-my-map-location.rar?dl=0
Please refer to this tutorial which has a lot of pictures and graphics in order for you to explain the whole process. Its pretty short and clear.
Hope this Helps!!
You are using Google Maps Android v1 API in your code that has been officially deprecated and you will no longer be able to request an API key for this version. Use this Guide to achieve Google Maps Android v2.

Map not showing using Google Maps API for Business

I'm migrating an app from Google Maps Android API v2 to Google Maps Android API for Business following instructions here : https://developers.google.com/maps/documentation/business/mobile/android/config#migrate_an_existing_application
This should be very straightforward but unfortunately after replacing all the com.google.android.gms.maps references to com.google.android.m4b.maps, the app is compiling right but the map is not showing : I get a gray rectangle instead.
One possible reason (and actually one thing I don't understand so far) is that the API key is the exact same as the one I used for Google Maps Android API. Logically, there should be a personal code to enter somewhere, something like the Client ID / Crypto key I've been sent by Google.
Can anyone help me?
From the documentation link below ,
https://developers.google.com/maps/documentation/business/mobile/android/auth
there seems to be a hidden service named "Google Maps Mobile SDK service"
which will be enabled by Google Enterprise Support when you sign up for the Google Map Mobile SDK for Business.
Once we purchase Business licence, enable this service in our project
and generate a Map V2 API key using same procedure for non business version
we should be able to see the tiles loading on Android Device.
Note:This observation is only based on documentation link above and not an experimented one.

Get Google Map V1 Key android

Since last few months I was making an application which incorporates Google Maps, and I was using Google Maps V1 in it. Yesterday I formatted my system, so the key which I was earlier using API V1 for the Google Maps is not working now for the development process.
Now I am trying to make the key for the API v1 again, but I am unable to do so. Can anyone please help me out. Whether I have to shift on Google Map API V2 now ??
I have generated one key using API V2 also. This is also not working. My code is written for Google Maps V1.
Google Maps API v1 is now deprecated so no more keys unfortunately...
Note: Version 1 of the Google Maps Android API has been officially
deprecated as of December 3rd, 2012. This means that from March 18th,
2013 you will no longer be able to request an API key for this
version. No new features will be added to Google Maps Android API v1.
However, apps using v1 will continue to work on devices. Existing and
new developers are encouraged to use Google Maps Android API v2.
from https://developers.google.com/maps/documentation/android/v1/
If you somehow had managed to save a copy of your debug.keystore file.. you need not have to use the Google Maps Android API v2..
Now no other option but to use the new API... Give it a try they have made things easier now.
One good and tricky answer from my side too.
As you have your own key ( but because you do not have the debug.keystore for the previous configuration), so you cant use your key. In this case you can do the below task :
Take the debug.keystore and debug API key for Google maps API V1 from anyone else system who has done google maps v1 and use that key for your development purpose, once it is complete and you have checked it, deploy it with the key which you already have for the application.
Let me know if you have any queries ?

How to get user's google api version on android?

I'm facing some rare problem. I have a device running on Android API 14. Anytime I try to use MapActivity I get the same error - java.lang.NoClassDefFoundError: android.security.MessageDigest. On other 99% devices it works perfect.
After some digging, I've found root of the problem.
The error is the result of a device manufacturer or ROM creator using
an older maps library with a new version of Android. (more at
What is 'android.security.MessageDigest''?)
The functionality of MapActivity isn't required for application, so I want to check if user has such device.
How can I get user's google api version on android?
Use Google map v2.
You want to use Google map console to register SHA-1 for signing the key in Google api console.
The complete tutorial can be found here.

google maps api key not working v2

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.

Categories

Resources