0

I'm trying a code gogole maps with cordoba with 2 different emulators , ripple chroome and the Android emulator normal . Ripple works and shows me a map geographic location , while the emulator Android rest a whole screen gray . Why ?

Alex
  • 47
  • 10

1 Answers1

0

I think the emulator is just failed to report its location.

And later I realized what is making that gray screen is we did not handle time-out probably. When we are getting the user location, it might take forever before the browser returns the location. Best practice is to first set a location and then update the maps later when the location becomes available. Also we should set the timeout for the geolocation too, as it is default to be Infinity.

I created a jsfiddle for that.

http://jsfiddle.net/x1115zw3/1/

=-=-=-=

To put the map in HYBRID, you should add mapTypeId: google.maps.MapTypeId.HYBRID in the maps option. So you mapOptions should looks like:

  var mapOptions = {
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.HYBRID
  };
kaho
  • 4,746
  • 1
  • 16
  • 24
  • before your ` // Try HTML5 geolocation`, try to set a default location. Look at line 19 of the jsfiddle. Also refer to this post for more information on timeout http://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt – kaho Jun 26 '15 at 16:00
  • I understood , but as I enter a default location without sending in error all ? – Alex Jun 26 '15 at 16:23
  • yea, that would prevent user stuck in the gray screen, and your map would be functional even if the HTML5 geolocation does not return a location, or occur errors – kaho Jun 26 '15 at 16:25
  • Thank you, could you come Even Change the map type in " hybrid " ? Why when I try to put it in the map options me everything goes wrong . – Alex Jun 29 '15 at 07:27
  • To put the map in HYBRID, you should add `mapTypeId: google.maps.MapTypeId.HYBRID` in the maps option – kaho Jun 29 '15 at 15:01
  • I had already tried in this way , when I put it sends me everything in error and no longer see the map , the same thing when I try to change the marker icon – Alex Jun 30 '15 at 10:31
  • if you try jsfiddle I see my mistake with map id – Alex Jun 30 '15 at 10:37
  • now the map worked, but geolocation in the emulator not see – Alex Jul 06 '15 at 08:40