September 24, 2018, 09:57:15 AM

Author Topic: Can you tell me how to query for the location change in GPS in Android?  (Read 553 times)

querygps

  • Guest
What code to follow to attain this?

I am just working out some code which shows the location change with the help of GPS system in Android with the help of predefined classes from android.position package but I want to know how to do the same in web standards as well.

Can you tell how to query the location change in GPS with web based standards in Android? What code to follow to attain this?




Offline infomaniac

  • Administrator
  • Full Member
  • *****
  • Thank You
  • -Given:
  • -Receive:
  • Posts: 173
  • Karma: +0/-0
    • View Profile
    • Poke This Member
To attain the location change in web based standards is simple and easy to do where you have to extend the watchPostion function as follows,

var id= navigator.geolocation.watchPosition(success_callback_function, error_callback_function, position_options)

In the above function the success_callback_function returns the needed information as like speed, altitude, longitude, latitude etc. an example as follows,

function success_callback_function(position){ // name of the function can be any
document.title=position.coords.speed; // will return the current reading speed in metres per second.
}

Now according to the above code we will get the relative speed which can be changed to get altitude, longitude, latitude etc. Now as you can see the “id” returns the location position which will help again to stop the monitoring for location changes with the below code,

navigator.geolocation.clearWatch(id);

In this way you can attain finding the location changes in web based standards in your Android devices, try to sort out the above codes given then go in for deep analysis which needs lot of time to understand and execute the functions which are available in the Google Maps JavaScript Library.

 
Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
Copyrights © InfoManiac

Related Posts Plugin for WordPress, Blogger...