简体   繁体   中英

geo location is not working in Phonegap

Hi any one can you please help me what it does mean

 define("cordova/plugin/geolocation", function (require, exports, module) {

                        var argscheck = require('cordova/argscheck'),
                                utils = require('cordova/utils'),
                                exec = require('cordova/exec'),
                                PositionError = require('cordova/plugin/PositionError'),
                                Position = require('cordova/plugin/Position');

we need any extra flies required for working geo location in PhoneGap.

Can any one please help me..

Thanks in Advance.

You don't need to change that code unless the geolocation plugin NOT installed and you are trying to install it manually.

I recommend the easy way: use the Cordova CLI interface.

Open a terminal/console, go to your project folder and run

cordova plugin add org.apache.cordova.geolocation

This will install && add the geolocation plugin to your project.
Afterwards go to your .js file and add

function geolocationSuccess (position) {
    alert(position.coords.latitude); 
}
navigator.geolocation.getCurrentPosition(geolocationSuccess);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM