Adding Geolocation and Map view to your app

It is very easy to add full geo location and map view to an existing application.

Download Geo Location Sample

Add a 2 new columns to your existing table structure

...
Config.tables["defects"] = "id;name;geo;address;owner;date DATE";
....

Get the phone current location and address during new record creation

In the code to insert a new record,
function newDefect() {
    var values = { date: Date.now(), owner:User.getName(), name:"new defect" };
    values.geo = Settings.getLocation();
    values.address = Settings.getAddress(values.geo);
    var id = Query.insert("defects", values);
    History.redirect("editDefect({id})");
}

Display the record on a map, with clickable pins

use Map.addItem(label, geo, onclick) and Map.show() to display all records on a map with click links

function viewMap() {
    var defects = Query.select("defects", "id;name;geo");
    for (var i = 0; i < defects.length; i++) {
        var defect = defects[i];
        Map.addItem(defect.name, defect.geo, "viewDefect({defect.id})");
    }
    Map.show();
}