I was just wondering...Is it possible to check whether a specific user has checked in a specific city?
For example, if John has previously checked in at some restaurants in London and Paris, is it possible to test from within my application if John has visited something in London or Paris?
Thanks!
Sure, within reason.
The user authenticates via OAuth2
You produce a number of recents to the checkin history https://developer.foursquare.com/docs/users/checkins.html - will probably need to use offset and limit to explore ALL of their check-ins
You will want to write an algorithm to figure out what 'city' means to you - perhaps X miles within the lat/long of the city center? For more detail, use a GeoCode API such as Google's or Bing's http://msdn.microsoft.com/en-us/library/ff701713.aspx
Related
I'm about to start expanding my secondhand app, where people can put their used university books for sale.
Right now the app is only available in one country, but in the near future other scandinavian countries will follow.
As an example I want to expand to Sweden, the user should only be able to see/buy/sell books that are for sale in that country.
I have come up with 2 solutions, but none of them are quite good:
Location decides country.
User selects the country from a list.
I would like to hear your thoughts on this, since lots of apps do this - but I can't figure out how.
Why not a combination of both? Try the location services first, if for whatever reason they have location services turned off or don't allow it, have them select their country. The country selection should be one of the first prompts they are given when they open the app (if location services aren't on). Otherwise, before they are allowed to post any books for sale. In other words they shouldn't be allowed to put a book up for sales without the app knowing which country they are in.
Are you using swift (what version) or objective-c?
https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/
You'll need a list of countries: How do I get a list of countries in Swift ios?
If you are willing to pay some. You could look at a ip based Solution like the www.maxmind.com api. It Gives country info and more. And we bought 50.000 queries for 50 dollars. And as we check once per user, we did not even finÃsh our bought queries!
I believe your application should do a guesswork and provide easy-to-use alternative for the case when the guess was incorrect. Get the country by location or IP. When the user installs the app, show the selected country and make sure your user can easily change it both in the installer and in the app itself (if, for instance, one student moves from a country to the other).
I'm working on an Windows Phone/iOS app (both native app), one feature I want is to have a textbox that auto-complete in a drop down menu as user enter a physical address (i.e. if user enter "new", the drop down should display "new york city, new orleans, etc", but only to city/county level).
Just like google's instant search complete: http://support.google.com/websearch/bin/answer.py?hl=en&answer=106230
To be more specific,
1) where should I put this city name database? I suppose local is a good idea as for city level it won't be too big and there's no delay?
2) where can I get a complete north america city list?
3) and are there any open-source library that can do the autocomplete?
Thanks!
From a WP7 point ov view. You can use the AutoComplete box. Unless there is a good reason to have a dynamic list, I would backage the list of cities within the app as that will make the autocomplete quicker.
I'm trying to find a good way to store and connect users based upon their city.
Location names can come from a variety of places, including facebook connection, ip lookup, and event user input.
I want to be able to input an address and get back a unique location ID. NY and New York will be understood as the same, but cities in two locations are not understood as the same.
Can I use facebook's location databse for this? Or google's location api? Or would it be better to roll my own, doing searches and filtering to consecutively narrow down results, from country to state to city, while normalizing for abbreviations, internationalizations, and typos? Or is there a plugin that will do this for me?
Thanks!
I would use https://github.com/alexreisner/geocoder . In general you have to add latitude and longitude to your model (they will identify location) and then specify which field should be geocoded. It allows you to store locations from different sources: city name, ip address and others. There are many configuration options (eg. you can specify Geocoding Services). Check out the gem readme page for all the details.
in my asp.net mvc app i have a survey Model that can be created by anyone. Moreover, i want people from specific part of world to participate (vote) in the survey. It is easy job if i know the location (it could be city, country or state etc.). i want to add this location restriction at the time of survey creation (i.e user could tell that people of Islamabad or punjab or Pakistan) could vote or fill out this survey form. Moreover, i want to add that location restriction is applicable (or expected) for small number of surveys (5 percent at most) so how to most efficiently implement this functionality.
You could do this a couple of ways:
Determine where the user is from based on a previous question asking their location. Not bullet proof as the user could easily say they are from somewhere they are not.
Obtain an IP -> Country mapping list that will provide you a lookup of the customer's IP address vs. their location. You would restrict based on this.
You can figure out someone's location using IP address. There are many services out there that offer IP address location. They will give you an approximation of the users location based on that.
Here is an example of the service:
You can also get their location using HTML5 geolocation features.
For your case using IP address is probably good enough. The HTML5 option is nice because if the user doesn't have a GPS device on their system it eventually falls back to using IP address location.
In order to get a users IP address in ASP.NET you can use
Request.Servervariables("REMOTE_ADDR")
i am doing some work for an iphone app that retrieves a bunch venues from a webservice, kinda like Yelp. They also want to be able to checkin to one such venue with Foursquare. Is it reasonable to demand that they also return a foursquare venue id, or do i have to look it up given a lat long? My concern is that even if i have a lat long, i dont necessarily know if the venue i looked up is the correct one. Do people just live with this uncertainty, or what? I should also elaborate that the UI is set up so that only one venue gets shown in the checkin UI. Maybe the solution is to provide multiple venues? Ideas? Opinions? Thanks!
If your other webservice offers Foursquare IDs, then getting them there will be your easiest solution. If not, you have two options:
Foursquare provides a location service that you could use to retrieve a list of nearby venues (https://developer.foursquare.com/venues/). That would give you a list of names, categories, addresses, and foursquare ids.
From there, you could search on your other webservice using name and address as needed and have the foursquare id straight from the source.
You can pass the search endpoint (https://developer.foursquare.com/docs/venues/search.html) a location and query string, then iterate over the results to see if you received a direct match.
This system is less precise than (1) (so, yes, you'll have to live with the uncertainty that a venue from your other service might not appear on foursquare, or might be at a slightly-incorrect location), but it will likely work in most situations.
I deal with this for my startup. Unfortunately, there's no good solution.
I have a batch job that given the lat/long and name, it searches the Foursquare API for any venue with the same name & within 0.1 miles. More than 5 times out of 10, the name will be different or there will be multiple venues with the same name. We had to manually set the Foursquare Id.