Vote count:
0
I have just finished my project that uses Google Maps API. when I tested on my mobile it failed. I started debugging and it seems to be having problems getting the current position
navigator.geolocation.getCurrentPosition(function(position){ ... }):
This line fails on Chrome and default browser, the callback function is never called (and I don't know how to see what error is thrown).
So I started using the Chrome emulator Refer to this
And it is different from the mobile. It enters the callback, does EVERYTHING it has to do and throws an error on something I can't identify. Says can't change innerHTML of undefined
Uncaught TypeError: Cannot read property 'innerHTML' of undefined VM1145:38
xI VM1149:38
(anonymous function) VM1145:33
cf {main,geometry,places}.js:20
...
weird thing: the number after VM (see it at the end of the first line VM1145) changes everytime I reload, it keeps increasing.
Inside the callback I do this
service = new google.maps.places.PlacesService(map);
And when I try to use the nearbySearch method of this object, it says service is undefined. If I type 'service' in the console, it prints the object...
So this emulator is not reliable right? I'm not sure if erros in emulator and real mobile are related. Do you know what can I do to make it work on my mobile?
Geolocation not working on mobiles
Aucun commentaire:
Enregistrer un commentaire