I am developing an IOT project in which I need the exact location of my phone to be sent to my website. How can I send the phone's exact location to my website in a wireless mode? If there are any APIs or any other ways then suggest. Thanks.
you can get your current location from network provider and GPS and send lat,long in your server.
-NETWORK PROVIDER LOCATION
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
loc = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}
-get location based GPS
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("GPS Enabled", "GPS Enabled");
if (locationManager != null) {
loc = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}
Above are few simple lines of code which successfuly returns location of user in loc object of Location class . By using this object we can easily get longitude and latitude of that location.
latitude = loc.getLatitude();
longitude = loc.getLongitude();