Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google maps not showing on android device

Android device only shows tiles for map. Seems to be widely reported. I followed the instructions of this link:

https://developers.google.com/maps/documentation/android/start

I did the following:

1) In Eclipse, I signed in Release Mode. I select File > Export. Selected Export Android Application, and clicked Next. Created a new keystore. Then uploaded the apk to google play.

2) Android app worked on device but map didnt show. It just showed tiles.

3) So I followed the instructions in the link above.

4) I located the keystore file that I created above. My keystore is called ziggy.keystore and alias is ziggy keystore.

5) I ran this in terminal on Mac OSX:

keytool -list -v -keystore ziggy.keystore -alias ziggy\ keystroke

6) The above command produces output that includes a line that contains the certificate's SHA-1 fingerprint. The fingerprint is the sequence of 20 two-digit hexadecimal numbers separated by colons.

7) Now that I have the signing certificate fingerprint, I created a project for the application in the Google APIs Console. In a browser, I navigated to https://code.google.com/apis/console/

8) I clicked Create Project. I named it API project. I see a list of APIs and services in the main window.

9) I scroll down until I see Google Maps Android API v2. To the right of the entry, I clicked the switch indicator so that it is on. I agreed to the terms of service and clicked accept.

10) In the left navigation bar, I clicked API Access. In the resulting page, I clicked Create New Android Key. In the resulting dialog, I entered the SHA-1 fingerprint, then a semicolon, then the application's package name.

11) I copied the API key. I opened my application's manifest, contained in the file AndroidManifest.xml. And add the following element as a child of the element, by inserting it just before the closing tag :

<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="your_api_key"/>

* Note that I used my real api key.

12) I added this as well:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


<permission
      android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
    <uses-permission android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"/>

<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>    

13) Then in my ShowMapActivity.java:

    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_map);
            mapView = (MapView) findViewById(R.id.mapview);

    myMapController = mapView.getController();  
    mapView.setBuiltInZoomControls(true);

    Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
            ...

14) Then in my show_map.xml file:

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:state_enabled="true" 
    android:apiKey="my_api_key"
/>

* I replaced my_api_key with the real key.

So I followed all the instructions and then when I downloaded the app on an android device, it did not show the map. It just shows the tiles thing, which has been reported before.

I'm not sure what step I missed to get this to work.

like image 320
JohnMerlino Avatar asked Nov 12 '22 15:11

JohnMerlino


1 Answers

The configuration steps looks good to me.

But i think you are interacting with the library in an old fashioned way. I know the documentation says that the MapView can be added and controlled to the Activities, but i would try to use the new GoogleMap and MapFragment approach. I'm not really sure how supported the "extending MapActivity and handling MapView" are on the V2 of the library

Here's the documentation for it: https://developers.google.com/maps/documentation/android/map#add_a_map_to_an_android_application

Have you tried it?

like image 128
Robert Estivill Avatar answered Nov 15 '22 05:11

Robert Estivill