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 ?
Asked
Active
Viewed 211 times
0
-
I think I had this before. And the solution is to wait... my Map shown up after something like 3 minutes. – kaho Jun 26 '15 at 14:21
-
Nope, simple map load in a few moment, while geolocation not load – Alex Jun 26 '15 at 14:26
1 Answers
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
-
-