function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Force.comForce.com 

Increase Decimal places in Latitude and longitude values

Standard salesforce library to get LAT/Lon values of an Iphone device is:

 

/*
Salesforce Mobile Client API
Copyright, 2009, salesforce.com, inc.
All Rights Reserved
*/

var mobileforce;

if (!mobileforce) {
    mobileforce = {};
}

mobileforce.Device = function() {};

mobileforce.Device.prototype.sync = function() {
    window.location.href = "mobileforce:///sync";
};

mobileforce.Device.prototype.close = function() {
    window.location.href = "mobileforce:///close";
};

mobileforce.Device.prototype.syncClose = function() {
    window.location.href = "mobileforce:///sync/close";
};

/**
 * Location API
 */

mobileforce.Device.prototype.setLocationAccuracy = function(value) {
    if (window.blackberry && window.blackberry.location.GPSSupported)
        window.blackberry.location.setAidMode(value);
};

mobileforce.Device.prototype.setLocationCallback = function(callback) {
    this.locationCallback = callback;
};

mobileforce.Device.prototype.bbLocCallback = function() {
    gotLocation(window.blackberry.location.latitude, window.blackberry.location.longitude);
};

mobileforce.Device.prototype.bbRequestLocation = function() {
    if (window.blackberry.location.GPSSupported) {
        window.blackberry.location.onLocationUpdate(mobileforce.device.bbLocCallback());
        var isUpdated = window.blackberry.location.refreshLocation();
        if (!isUpdated)
            setTimeout("mobileforce.device.bbRequestLocation()",1000);
    } 
    else {
        alert('GPS not supported');
    }
}

mobileforce.Device.prototype.getLocation = function(callback) {
    if (callback)
        this.locationCallback = callback;
    if (window.blackberry) {
        mobileforce.device.bbRequestLocation();
        //call again in 3 seconds to ensure that we get a real location
        setTimeout("mobileforce.device.bbRequestLocation()",3000);
    } else {
        Device.available = true;
        Device.exec("/getloc");
    }
};

var Device = {  
    available: false,
    init: function() {
        if(Device.onGapInit) {
            try {
                Device.onGapInit(); 
            } catch (e) {
            }
        }
    },
    exec: function(command) {
        if (Device.available) {
            try {
                window.location.href = "mobileforce://" + command;
            } catch(e) {
                alert("Error executing command '" + command + "': " + e.name + "," + e.message);
            }
        }
    }
}

mobileforce.device = new mobileforce.Device();

function gotLocation(lat, lon) {
    if (mobileforce.device.locationCallback)
        return mobileforce.device.locationCallback(lat, lon);
    
    return false;
}

Through visualforce, I am calling the above library as:

 

function getLocation() {
        mobileforce.device.getLocation(updateLocation);
        //work around required for BB
        if (window.blackberry)
            setInterval("getLocation()", 10000);
            return false;
    }

The values of Latitude and Longitude which I get are:

Lat = 4.567678000000000

Lon = 5.342564000000000

 

Is it possible to increase the decimal places something like:

Lat = 4.567678123425363

 

Thanks,

Pragati