Hello Friends,
With the help Phone Gap Api, You can easily get current position using GPS .
To start playing with it, Please have a look at this simple function or Code:
Also Please add permission in your plugin.xml file
1.<plugin name="Geolocation" value="com.phonegap.GeoBroker"/>
2. <plugin name="Notification" value="com.phonegap.Notification"/>
Enjoy Coding.... :)
Please, write questions in comments.
Don’t forget share this post....... :)
With the help Phone Gap Api, You can easily get current position using GPS .
To start playing with it, Please have a look at this simple function or Code:
// Check if geolocation is available
if(navigator.geolocation) {
// This is the specific PhoneGap API call
navigator.geolocation.getCurrentPosition(function(p) {
// p is the object returned
alert('Latitude '+p.coords.latitude);
alert('Longitude '+p.coords.longitude);
}, function(error){
alert("Failed to get GPS location");
});
} else {
alert("Failed to get GPS working");
}
Also Please add permission in your plugin.xml file
1.<plugin name="Geolocation" value="com.phonegap.GeoBroker"/>
2. <plugin name="Notification" value="com.phonegap.Notification"/>
Enjoy Coding.... :)
Please, write questions in comments.
Don’t forget share this post....... :)