I use geolocation API on Android through a web app all the time. Try this sample and see if it works for you: [https://samples.azuremaps.com/?search=geolocation&sample=geolocation-control (Try loading it in your Android browser first to see if it works. If not, then you may not have given your browser permission to access your location which is unusual but similar to how you would have to handle the user not sharing their location in a native app.)
Route API - how to use Current location in URL
hi
using this url for example -
https://dev.virtualearth.net/REST/V1/Routes?wp.0=30.85401,34.776949&wp.1=31.822634,34.895169&wp.2=30.62088,34.919876&key=<key>&routeAttributes=transitStops&o=xml&optimizeWaypoints=false&DistanceUnit=Kilometer&travelMode=Driving
is it possible to specify My Current location in wp.0 instead of the coordinates - so that routing will start dynamically from my location.
thank you very much
2 answers
Sort by: Most helpful
-
rbrundritt 18,591 Reputation points Microsoft Employee
2023-01-26T18:10:55.5366667+00:00 -
rbrundritt 18,591 Reputation points Microsoft Employee
2023-01-19T06:52:29.8366667+00:00 No. Servers don't accurately know where you. At beast they might be able to guess your city. Accurate location data is only available through sensors on the end users device. So you have to get the users location from the device, and pass the coordinates into the route request.
There are a lot of ways to get the users location from their device depending on the type of app you are creating. For example, if you have a web app, you can get the users location from the browser using the geolocation API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API