facebook

Retrieving the GPS data

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #342375 Reply

    Timo Frenzel
    Member

    Hi people,

    I’m new in terms mobione.

    How can I get lat and long GPS data?

    I want to get this after a button press and let me just show as text.

    In the later course I want to send this data to a website.

    Unfortunately I can not find any information about it.

    Timo

    
    getGeoDatas = function(){
      
        var long = "";
        var lat = "";
    
        //how i can get the GPS Data?
        
      
        $('#m1-Untitled1-textField1').val(long + " / " + lat);
    }​
    
    #342378

    Brandon
    Member

    You need to use the Cordova API:

    // onSuccess Callback
    // This method accepts a Position object, which contains the
    // current GPS coordinates
    //
    var onSuccess = function(position) {
    alert(‘Latitude: ‘ + position.coords.latitude + ‘\n’ +
    ‘Longitude: ‘ + position.coords.longitude + ‘\n’ +
    ‘Altitude: ‘ + position.coords.altitude + ‘\n’ +
    ‘Accuracy: ‘ + position.coords.accuracy + ‘\n’ +
    ‘Altitude Accuracy: ‘ + position.coords.altitudeAccuracy + ‘\n’ +
    ‘Heading: ‘ + position.coords.heading + ‘\n’ +
    ‘Speed: ‘ + position.coords.speed + ‘\n’ +
    ‘Timestamp: ‘ + position.timestamp + ‘\n’);
    };

    // onError Callback receives a PositionError object
    //
    function onError(error) {
    alert(‘code: ‘ + error.code + ‘\n’ +
    ‘message: ‘ + error.message + ‘\n’);
    }

    //Place this in the button you want to get the data with
    navigator.geolocation.getCurrentPosition(onSuccess, onError);

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Retrieving the GPS data

You must be logged in to post in the forum log in