Resources: - HTML Geolocation: www.w3schools.com/html/html5_... - Google Maps Reverse Geocoding: developers-dot-devsite-v2-pro... - Get a Google Maps API Key: cloud.google.com/maps-platform/
How is it working for you guys? Chrome denies geolocation permissions on anything other than HTTPS. Its not working for me. Update: Nvm, if you are having the same trouble as me you must click on the button to the left of the url (Not the crosshair one to the right of the url) And it will ask you to allow or disallow permission
Thank you very much for your awesome help ! I ask myself just how i can change the "big red point" in own soft geolocalisation indicator ? :) There is an option in the Google API ? Thank you for answer
. pls why my this.state lat and lng looks like strings , theyre not highlitened according to thier distict colors . also when using backticks varialblies are not set with url
Thanks this great work. what will config.js contain hance you did import it as part of obtaining reverse Gecoding Address? I think congig.js file can really help. thanks
Hey Roelane, good question! I'm simply importing my Google Maps API key since I didn't want it to be public in the video. In the config.js file, I have: export const GOOGLE_API_KEY = ' ' with my key within the quotes. It's best practice to keep the key private and put config.js in the .gitignore file, but you don't need to for testing...you can just put your key directly in the API call instead of ${GOOGLE_API_KEY}. Hopefully that makes sense.
Im trying the same of you but when i tried to get the coordinates, i see the permisson but when i agree does not work. I cant see the position object in console. Can you update o share your demo (repo)
Taylor Griffith Hi! I search this issue and I discover the problem, it’s the permissions, on desktop works on chrome because for default ask the permission but when I tried on mobile don’t allow and the prompt for permission don’t appear... Yo have some ideas to solve this problem?
Dev GSoft Good question. I don’t know for sure, but here’s some possible reasons: www.storelocatorwidgets.com/blogpost/20453/Everything_you_ever_wanted_to_know_about_HTML5_Geolocation_Accuracy
z!shan al! It’s GOOGLE_API_KEY= and then paste your api key. Or remove that and put the key directly in the url for the api call (but that’s more of a security risk if used in production)
Md Nazmul Hossain Check what the api call is returning through a console log or in the network tab in chrome. You’re likely not getting a successful response so it’s undefined.
Md Nazmul Hossain ok that looks right. Erase that key since it’s public now and generate a new one. Make sure the key is unrestricted for testing. It’s hard for me to say what to fix without knowing what error you’re getting. Are you able to confirm whether you’re getting any data back by console logging the result of the api call (successful or error)? Or checking what the api is returning in the network tab?