12717

Google Map showing Blank

Question:

I have Developed an application that have Google Map functionality so i use new google play services library but when i launch Google map activity its showing map but blank so what is wrong with my code

my manifest file xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.apa" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" /> <permission android:name="com.example.apa.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <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" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-library android:name="com.google.android.maps" /> <application android:debuggable="false" android:allowBackup="true" android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light"> <activity android:name="***************" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="*****.*****.***.ViewOnMap" android:label="@string/title_activity_view_on_map" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value=*********************************" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application>

layout file

<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" class="com.google.android.gms.maps.SupportMapFragment" android:name="com.google.android.gms.maps.MapFragment" />

activity file

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_on_map); Global.startAppAd.loadAd(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); }

LogCat error

Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).

Answer1:

<ol><li>Check your API key carefully</li> <li>Check your SHA key carefully</li> <li>You should be connected to internet using WIFI before first time using Google map and wait 2-3 min till download map data etc. next time no need to connected with internet but if u want to search another location it must also be connected with internet using WIFI .</li> </ol>

Answer2:

By seeing the <strong>LogCat error Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).</strong>

it seams its problem with Authentication. and Code should have <strong>googleMap = fm.getMap();</strong>

// Getting reference to the SupportMapFragment of activity_main.xml SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); // Getting GoogleMap object from the fragment googleMap = fm.getMap();

Try to use this... And Double check SHA1 key

<strong>EDIT</strong> :

Check Phone Location settings also..

Answer3:

Try these:

<ul><li>

<strong>Google Play Services:</strong>

You have to download the latest Google Play Services <a href="http://www.androidfilehost.com/?fid=23501681358540606" rel="nofollow">com.android.vending-4.8.20.apk</a>.In that site if google play services wasn't working means you can find a lot of sites in internet named com.android.vending 4.8.20.apk.

you can run the Google play Services by using the Command Prompt adb install com.android.vending 4.8.20.apk.

<strong>Note:</strong> You have to download the latest Google play services because year by year latest version will be updated in internet.

</li> </ul>

Recommend

  • Relative path for SQLite not working with WIX Toolset
  • Parse.com Push notification fails to be received
  • App doesn't show firebase notifications (broadcast intent callback: result=CANCELLED forIntent)
  • how to attach debugger to device? chrome extention
  • Android java.lang.SecurityException for system app
  • Hiding the navigation bar immediately on app launch
  • Android Map v2 not works in emulator errors are occurred in log cat
  • Android doesn't show logcat messages
  • “Application not installed” Error on Android
  • capistrano password prompt
  • Why admob ads in ANY apps not displaying
  • ActionBar three-dot dropdown opens at the wrong place
  • ndb ComputedProperty filtering
  • Azure SSL Certificate
  • Styling text for textarea Wicket
  • Change Design Support Navigation View Header Title Programmatically
  • Android error - Failed to find style 'toolbarStyle' in current theme
  • How to modify the HTML tag in Drupal 6?
  • write text on image and show it to a imageview
  • Unable to resolve Static method?
  • How to resolve permission denied maybe missing internet permission?
  • UIAlertController button function not working
  • Validate child input components on submit with Vee-Validate and vue js 2
  • Android Google Maps API v2 start navigation
  • Jenkins: How To Build multiple projects from a TFS repository?
  • javaw.exe and eclipse startup problems
  • sending/ receiving email in Java
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • How to set my toolbar fixed while scrolling android
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • using HTMLImports.whenReady not working in chrome
  • Android Google Maps API OnLocationChanged only called once
  • apache spark aggregate function using min value
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs