Using the Foursquare API to find nearby places


#1

Hi,

I am attempting to use the Foursquare API to find nearby places after not having much luck with the Google Maps Key.

I’m using the below from Cityforks after adding the relevant Cordova API to get the current location which works like a dream:

Meteor.startup(function() {
navigator.geolocation.getCurrentPosition(success);
});

success = function(position) {
Session.set(‘location’, position);
debugger
Meteor.call(‘fetchNearbyLocations’, position.coords)
}

I also have this in a client folder:

Foursquare = {
find: function(options, callback) {
Meteor.call(‘foursquare-search’, options, function(error, data) {
callback(error, data);
});
}
};

And this on the server:

if (Meteor.isServer) {
Meteor.methods({
checkFoursquare: function (params) {
this.unblock();
var url = “https://api.foursquare.com/v2/venues/explore”;
params.client_id = ID Inserted here;
params.client_secret = Secret inserted here;

        return Meteor.http.call("GET", url, {data: params});
    }
});

}

What I’m wanting to do is have a selection of various places, e.g. restaurant, nightclub, etc. in the html, within a 100km radius from current location and when a user specifies the type of venue, the results upload to a Mongo collection (no displaying on a map necessary)