Piraba Piraba - 2 months ago 9
Android Question

Google Map does not display in Android -not display map except boxes and zooming button

I have developed an android app using google maps api. I created and used an api key, even but the map is not shown/visible as expected. Grey color title & zoom button are show/visible.

I followed this Link

My application is unsigned application.

This map file location(package) available in com.xont.hema6.controller.sale but main package is com.xont.hema6.controller . which one needs to be specified for key?

My code is :

public class RetailerMapActivity extends FragmentActivity{
GoogleMap map;
ArrayList<LatLng> markerPoints;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
markerPoints = new ArrayList<LatLng>();
SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
map = fm.getMap();

}


This is my xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".sale.RetailerMapActivity" >

<fragment
android:id="@+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.SupportMapFragment" />




AndroidMainfest file permission

<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission android:name="com.xont.hema6.controller.sale.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
<uses-permission android:name="com.xont.hema6.controller.sale.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />


inside application

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIza**CD3c**JoP27sH_EsGTR7ul***w_G3pS7o"/>


http://wptrafficanalyzer.in/blog/drawing-driving-route-directions-between-two-locations-using-google-directions-in-google-map-android-api-v2/

Please anyone suggest that what is wrong in my code.

Answer

Go to your manifest file see your package name by use this package name you must create Google Maps API V2 key and use

Ex:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.venky.loadgooglemapsdemo"
    android:versionCode="1"
    android:versionName="1.0" >

My package name is "com.venky.loadgooglemapsdemo"

If you want Tutorial and Demo please see this link