<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[foursquare-developers - Medium]]></title>
        <description><![CDATA[Foursquare Developers - Medium]]></description>
        <link>https://medium.com/foursquare-developers?source=rss----49024f11af2---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*MXL-j6S8fTEd8UFP_foEEw.png</url>
            <title>foursquare-developers - Medium</title>
            <link>https://medium.com/foursquare-developers?source=rss----49024f11af2---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 23 Apr 2017 05:45:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/foursquare-developers" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Exploring Foursquare Data using GoLang]]></title>
            <link>https://medium.com/foursquare-developers/exploring-foursquare-data-using-golang-e93e0f699c0d?source=rss----49024f11af2---4</link>
            <guid isPermaLink="false">https://medium.com/p/e93e0f699c0d</guid>
            <category><![CDATA[location-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[appengine]]></category>
            <category><![CDATA[foursquare]]></category>
            <dc:creator><![CDATA[Gareth Paul Jones]]></dc:creator>
            <pubDate>Fri, 27 Jan 2017 04:33:28 GMT</pubDate>
            <atom:updated>2017-01-30T23:03:03.345Z</atom:updated>
            <content:encoded><![CDATA[<p>We love using GoLang. It’s very easy to learn, and yet incredibly powerful. To explore this power further, we put together a simple project to get you started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpeeR2YXzsGCmWz6tfYrcg.png" /></figure><p>In a <a href="https://medium.com/foursquare-developers/golang-support-for-oauth-c85c5e69270b#.jd85h92p8">previous post</a> we discussed <a href="https://medium.com/foursquare-developers/golang-support-for-oauth-c85c5e69270b#.jd85h92p8">adding support</a> for #GoLang to the sub-package <a href="https://godoc.org/golang.org/x/oauth2">OAuth</a>. To extend this work further, this project allows you to explore the <a href="http://developer.foursquare.com">Foursquare API</a> in more depth and additionally provide some proposed edits.</p><p>The project is split into two parts:</p><ul><li>app — containing details about the app serving content via AppEngine</li><li>fsq — a lightweight library for go to perform search and display venue information.</li></ul><p>This project will touch on two Foursquare API endpoints: <a href="https://developer.foursquare.com/docs/venues/search">venues/search</a> and <a href="https://developer.foursquare.com/docs/venues/proposeedit">venues/VENUE_ID/proposeedit</a> .</p><h3>Getting Started</h3><h3>1. Get Your Developer Keys</h3><p>Sign up for a <a href="https://developer.foursquare.com/">Foursquare Developer</a> or <a href="https://enterprise.foursquare.com/contact-us">Enterprise Account</a>.</p><p>Once you get setup you should have two important pieces of information:</p><ol><li>CLIENT_ID — Unique to your registered application.</li><li>CLIENT_SECRET — Unique and private to your application.</li></ol><p>Please remember to keep these keys in a secure location.</p><h3>2. Clone this repo</h3><p>git clone <a href="https://github.com/garethpaul/fsq-go-explore.git">https://github.com/garethpaul/fsq-go-explore.git</a></p><h3>3. Amend App.yaml with your variables</h3><p>These are directly environment variables.</p><pre>env_variables:<br>  FSQ_CLIENT_ID: &#39;YOUR_FOURSQUARE_KEY&#39; // found in step 1<br>  FSQ_CLIENT_SECRET: &#39;YOUR_CLIENT_SECRET&#39; // found in step 1<br>  FSQ_VERSION: &#39;YYYYMMDD&#39; // e.g. 20170101</pre><h3>4. Run your application</h3><pre>goapp serve</pre><p>Once your application is up and running, you can tweak it to your needs.</p><p>And if you’ve come this far, we’d <a href="https://twitter.com/foursquareapi">love to hear from you</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e93e0f699c0d" width="1" height="1"><hr><p><a href="https://medium.com/foursquare-developers/exploring-foursquare-data-using-golang-e93e0f699c0d">Exploring Foursquare Data using GoLang</a> was originally published in <a href="https://medium.com/foursquare-developers">foursquare-developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ride Up for Android]]></title>
            <link>https://medium.com/foursquare-developers/ride-up-for-android-89718718ab59?source=rss----49024f11af2---4</link>
            <guid isPermaLink="false">https://medium.com/p/89718718ab59</guid>
            <category><![CDATA[location-intelligence]]></category>
            <category><![CDATA[foursquare]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Gareth Paul Jones]]></dc:creator>
            <pubDate>Wed, 07 Dec 2016 15:59:34 GMT</pubDate>
            <atom:updated>2016-12-07T18:30:13.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1ES0bixDsSwYGWvW2EQag.png" /></figure><p>One of the things we have often heard from developers is that they’d like to deeply integrate location intelligence into their <em>own </em>apps without investing heavily into a custom implementation.</p><p>In response to this feedback we’ve been working hard to constantly improve our <a href="https://github.com/foursquare/placepicker-sdk-sample">PlacePicker SDK</a> for Android. This is a simple, beautiful and elegant way to bring location intelligence — right inside your app.</p><p>To showcase some of this recent work we built <a href="http://rideup.xyz">RideUp</a> — a sample ride sharing app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*vGgoCwvatM9g1a2UmfS4gg.gif" /></figure><h3>Overview</h3><p><em>Developers</em></p><p>For developers looking to add location intelligence to their app, it’s no easy task. The very thought of building a sample ride-sharing app is one of many complex decisions including location, operations, latency, mapping and much much more.</p><p>We built this ride-sharing app to showcase the PlacePicker SDK, which makes it faster and easier for developers to implement location intelligence in their app. In this case we spent less time worrying about where our RideUp users were in the world and potentially more time focused on the many other challenges that come with building or adding features to apps.</p><p>You can grab the code for this sample on <a href="http://github.com/garethpaul/ride_up">Github</a>.</p><p><em>Users</em></p><p>After opening the app, users can start their quest to get a ride by tapping on pickup location at the top of the screen. We then present the user with a list of possible venues they’re currently at, as well as an option to search a given city if current location is disabled. If a user taps on a given location they’ll be able to request a vehicle from that venue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*wI2fJq2tljMlXeUVLP9SeA.png" /></figure><h3>Code Walkthrough</h3><p>In this walkthrough you will learn how to:</p><ol><li>Sign-up for a Foursquare API key</li><li>Find the nearest venue</li><li>Select the best location</li></ol><p>If you want to take a look at the live app before continuing you can download it from the <a href="https://play.google.com/store/apps/details?id=com.foursquare.rideup">App Store</a>.</p><p>This tutorial is written for Android and is intended for those who are familiar with Android development. If you’ve never built an Android app before, check out some of the great online resources to get you started.</p><h3>Get the code</h3><p>The best way to start is to grab the code from <a href="https://github.com/garethpaul/ride_up">GitHub</a> and open in Android Studio. The project is built using Android Studio and Gradle.</p><h3>App structure</h3><p>The app is made up of essentially two classes:</p><ol><li>MainActivity.java | Main Activity to request a veh</li><li>Constants.java | A class to contain API keys</li></ol><h3>Setting up Foursquare API</h3><p>To sign-up for a free Foursquare API key navigate to <a href="https://developer.foursquare.com/">developer.foursquare.com</a> and create a new app. After you create a new app you’ll get two very important pieces of information, a client id and client secret. You’ll need both of these to start using the PlacePicker SDK.</p><p>In addition you will need a mapbox access token via <a href="https://www.mapbox.com/">Mapbox</a>, to power the mapping in our app.</p><p>Once you get your client id and client secret, paste them into the FOURSQUARE_CLIENT_KEY and FOURSQUARE_CLIENT_SECRET variables in the public class Constants.</p><pre>public static final String <em>FOURSQUARE_CLIENT_KEY </em>= &quot;&quot;;<br>public static final String <em>FOURSQUARE_CLIENT_SECRET </em>= &quot;&quot;;<br>public static final String <em>MAPBOX_ACCESS_TOKEN</em> = &quot;&quot;;</pre><p>Note: For production applications, we’d recommend the Android <a href="http://developer.android.com/training/articles/keystore.html">KeyStore</a> API for storing these values.</p><h3>Build and run the app</h3><p>At this point you should be able to build and run the app. Tap on the Map to see some random vehicles. Tap on the location bar and you should be able to see the venue you’re currently at or the venue you want to request a pick-up from.</p><p>Now that you’ve got your app up and running, lets look into some of the code.</p><h4>Quick and Easy Implementation</h4><p>Android Developers can quickly add the PlacePicker SDK to their app in a few minutes by simply adding the SDK to their build.gradle file.</p><pre>compile &#39;com.foursquare:placepicker:0.6.1&#39;</pre><h4>Determine the current location</h4><p>The MainActivity class is where we call the methods to work with the PlacePicker SDK.</p><pre>PlacePickerSdk.<em>get</em>().getCurrentPlace(new PlacePickerSdk.CurrentPlaceResult() {<br>    @Override<br>    public void success(Venue venue, boolean confident) {<br>        lat = venue.getLocation().getLat();<br>        lng = venue.getLocation().getLng();<br>}</pre><p>Special thanks to <a href="https://twitter.com/kfow35">Kyle</a>, <a href="https://twitter.com/ryan_kotzebue">Ryan</a>, <a href="https://twitter.com/matthewhuie">Matthew</a> and the team at <a href="https://twitter.com/mapbox">Mapbox</a>. We work in a creative environment where we love to jam on ideas with engineers, product managers and designers. Our mission is to provide the world with better location intelligence products. If this sounds like fun, we’re hiring to build many more things — we need your help. <a href="https://twitter.com/gpj">Reach out</a>, let’s grab a coffee, and come join us.</p><p>And if you’ve come this far, we’d <a href="https://twitter.com/foursquareapi">love to hear from you</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89718718ab59" width="1" height="1"><hr><p><a href="https://medium.com/foursquare-developers/ride-up-for-android-89718718ab59">Ride Up for Android</a> was originally published in <a href="https://medium.com/foursquare-developers">foursquare-developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mr. Jitters for Android]]></title>
            <link>https://medium.com/foursquare-developers/mr-jitters-for-android-87b5e5991f67?source=rss----49024f11af2---4</link>
            <guid isPermaLink="false">https://medium.com/p/87b5e5991f67</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[foursquare]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[retrofit]]></category>
            <dc:creator><![CDATA[Matthew Huie]]></dc:creator>
            <pubDate>Wed, 30 Nov 2016 00:08:25 GMT</pubDate>
            <atom:updated>2017-01-14T19:28:23.496Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YxBlEzRii6UVveYv7Ec_CQ.png" /></figure><p><em>A sample Android app, powered by Foursquare.</em></p><p>(Looking for a sample app for iOS? Head over to <a href="https://medium.com/u/d4b5509c6d4d">Foursquare API</a> and read our post on <a href="https://medium.com/@FoursquareAPI/mr-jitters-for-ios-f43e934735a3#.7xdjm6eu8">Mr. Jitters for iOS</a>.)</p><p>At Foursquare, location is at the heart of everything that we do. Through the Foursquare API, we give developers and enterprises opportunities to tap into the core of Foursquare’s location intelligence and empower them to build meaningful experiences and business solutions.</p><p>We are extending our love for coffee into an exercise for learning about adapting the Foursquare API on Android. This exercise will go through techniques of requesting data from the Foursquare API, as well as leveraging other libraries/APIs for location and mapping. By the end of this post, you should have a good understanding of how to make requests to the Foursquare API and parse responses from the Foursquare API on Android.</p><p>This exercise will touch on two Foursquare API endpoints: <a href="https://developer.foursquare.com/docs/venues/search">venues/search</a> and <a href="https://developer.foursquare.com/docs/search/recommendations">search/recommendations</a>. To showcase how these API endpoints are used, we developed a sample app, Mr. Jitters. Mr. Jitters is currently available on the <a href="https://play.google.com/store/apps/details?id=com.matthewhuie.mrjitters">Google Play Store</a>, and the sample Android Studio project is available on <a href="https://github.com/matthewhuie/Mr.Jitters">Github</a>.</p><p>In summary, this post will consist of the following sections:</p><ol><li><strong>Overview</strong></li><li><strong>What are all of these files?</strong></li><li><strong>How do I become a Foursquare developer?</strong></li><li><strong>Foursquare, make me a sandwich!</strong></li><li><strong>Hello, JSON!</strong></li><li><strong>Hurray, you did it!</strong></li></ol><h3>Overview</h3><p>As a sample app, Mr. Jitters keeps everything simple and highlights the fundamental steps needed to interact with the Foursquare API on Android.</p><p>The app contains three basic views — home, location, and map. On the home view, the user begins by tapping on the Mr. Jitter icon. Once on the location view, the user is presented with his/her last-known location and a list of search results. When a coffee spot is selected, a map is shown with the venue’s location marked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-6WibdiLstFQlmuzhKVORQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UMI4badrgHvKc9AcmTtHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsZh6cCG690azrxastD-OQ.png" /><figcaption>The three views of the Mr. Jitters app — home, location, and map.</figcaption></figure><p>Within the three views above, Mr. Jitters does quite a bit of work in the background. When the user taps on the Mr. Jitters icon, the user’s last location is retrieved. Once the user’s location is determined, a request is made to Foursquare to “snap” the user to a known venue. At the same time, another request is made to Foursquare to search for all recommended coffee spots within the immediate area. Finally, when a user clicks on a specific coffee spot, that venue is marked on a map.</p><p>In order to interact with different technologies and data sources, Mr. Jitters enlists the help of several libraries. All of the libraries below are imported and compiled via Gradle within Android Studio.</p><ul><li><a href="https://developers.google.com/android/"><strong>Google APIs for Android</strong></a><strong> </strong>— an API for obtaining user location details</li><li><a href="https://square.github.io/retrofit/"><strong>Retrofit</strong></a> — a client for making HTTP requests</li><li><a href="https://github.com/google/gson"><strong>Gson</strong></a> — a (de)serialization library for converting JSON into Java objects</li><li><a href="https://developers.google.com/maps/documentation/android-api/"><strong>Google Maps Android API</strong></a><strong> </strong>— an API for displaying custom maps</li></ul><h3>What are all of these files?</h3><p>Within the sample Android Studio project, there are 11 Java files, consisting of 3 Activity classes, 1 Adapter class, 1 service interface, and 6 Java Object classes. The model logic is represented by the Java Object classes, and the view/controller logic is represented by the Activity and Adapter classes.</p><p><strong>MainActivity</strong>— displays the home view and handles the initial user interaction</p><p><strong>PlacePickerActivity</strong>— calls Google APIs for Android to obtain and display the user’s last-known location, calls the Foursquare API using Retrofit to obtain, and uses Gson to parse the resulting JSON and display a list of search results</p><p><strong>MapActivity</strong>— displays the map view, plots a marker for a specified venue, and links back to Foursquare</p><p><strong>PlacePickerAdapter</strong>— handles the view and control of the venue search results for PlacePickerActivity</p><p><strong>FoursquareService</strong>— provides the Retrofit interface for accessing the Foursquare API with two methods: snapToPlace()and searchCoffee()</p><p><strong>FoursquareJSON</strong>— represents the JSON returned from the Foursquare API</p><p><strong>FoursquareResponse</strong>— represents the response object returned within the JSON from the Foursquare API</p><p><strong>FoursquareGroup</strong>— represents the group object returned within the response object from the Foursquare API</p><p><strong>FoursquareResults</strong>— represents the results object returned within the group object from the Foursquare API</p><p><strong>FoursquareVenue</strong>— represents the venue object returned from the Foursquare API (note that the parent of this depends on the type of call)</p><p><strong>FoursquareLocation</strong>— represents the location object returned within the venue object from the Foursquare API</p><p>The Activity and Adapter classes are developed for the Android platform, so we won’t dive into much detail on this topic. The service interface and Java Objects were designed to handle the JSON response from the Foursquare API, and will be further detailed below.</p><h3>How do I become a Foursquare developer?</h3><p>To start developing with the Foursquare API, you will need to register for a Foursquare developer app. You can start by visiting the <a href="https://developer.foursquare.com/">Foursquare for Developers</a> website and creating a new app.</p><p>Once you’ve done this, you should have a corresponding client ID and client secret for your app. With a client ID and client secret, you will have access to the <a href="https://developer.foursquare.com/docs/">Foursquare API endpoints</a>.</p><p>For the purposes of this sample project, you will also need to be a Google Maps developer, in order to create and display custom maps. You can get an API key by visiting the <a href="https://developers.google.com/maps/documentation/android-api/">Google Maps Android API</a> website.</p><p>Now, you can enter these details into the sample project with your API keys. Create a new file called res/venues/api.xml with the following contents:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9670fe301078c5625eca40f6cb33f33/href">https://medium.com/media/b9670fe301078c5625eca40f6cb33f33/href</a></iframe><h3>Foursquare, make me a sandwich!</h3><p>Unfortunately, you can’t send a request for a sandwich to the Foursquare API (sorry!). However, you can request to “snap” a user to a known venue and to search for recommended coffee spots nearby using the Foursquare API. Within FoursquareService, we have defined two methods that will perform these functions.</p><p>The endpoints provided by the Foursquare API are generally access via HTTP. Within the Android environment, these HTTP requests are represented as Retrofit Call definitions, which we can see within FoursquareService:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da8ac9016339f9b155888c27f38f986d/href">https://medium.com/media/da8ac9016339f9b155888c27f38f986d/href</a></iframe><p>Above, you can see each HTTP request within the @GET annotations. Note that there are a few mandatory parameters when using search via the Foursquare API — v, client_id, client_secret, and ll. We also specify llAcc to improve location matching. (For more details, see the <a href="https://developer.foursquare.com/docs/">Foursquare API Endpoints</a> website.)</p><p>For snapToPlace(), we are calling the <a href="https://developer.foursquare.com/docs/venues/search">venues/search</a> API endpoint, which returns venue results based on the specified location. We also specify an additional parameter, limit=1, so that the Call will return only the venue where the user is most likely to be at.</p><p>For searchCoffee(), we are calling the <a href="https://developer.foursquare.com/docs/search/recommendations">search/recommendations</a> API endpoint, which returns recommended venues around the specified location. An additional parameter, intent=coffee, is present so that the results will only be venues related to coffee.</p><p>To form a request to the Foursquare API, we use Retrofit to create an HTTP connection and make the request. In Java, this involves the following:</p><ul><li>A Retrofit object with a base URL (https://api.foursquare.com/v2/) and a converter factory (using Gson here for JSON).</li><li>A FoursquareService object that gives Retrofit access to the defined functions.</li><li>A Call object that performs one of the FoursquareService functions, accepting parameters for client ID, client secret, and user location details.</li><li>Invoking the Call.enqueue(Callback) method to start the request asynchronously.</li></ul><p>For snapToPlace() and searchCoffee(), here is a code snippet from PlacePickerActivity:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e009b8ab31c649af085cc1b2f1487821/href">https://medium.com/media/e009b8ab31c649af085cc1b2f1487821/href</a></iframe><p>With the above structure, the HTTP request will initiate when Call.enqueue(Callback) is called. This is will run asynchronously and will execute the defined callback to parse the response, once the request has completed.</p><h3>Hello, JSON!</h3><p>Now that we understand how to form and make requests using Retrofit, we can now say ‘Hello, JSON!’ and parse the JSON responses. Since we are using Gson as our deserialization library, converting a Foursquare API response in JSON to meaningful data in Android becomes super simple.</p><p>To understand how Gson works, let’s take a look at a sample response from a <a href="https://developer.foursquare.com/docs/venues/search">venues/search</a> request.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/46d57b16d6d0715c0c74eb3fdfabe040/href">https://medium.com/media/46d57b16d6d0715c0c74eb3fdfabe040/href</a></iframe><p>In the response above, each level within the JSON has a corresponding Java Object. Therefore from this response, we’ll be using FoursquareJSON, FoursquareResponse, FoursquareVenue, and FoursquareLocation. Within each one of these classes, you can see the levels being built, down to the venue and location level. And that’s it! The Gson library will take care of everything else for you.</p><p>Now looking back at PlacePickerActivity, you should be able to see how the Java Objects are used to parse out the data from the JSON. With snapToPlace(), we have the following code snippet:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e72d72e00fb5ac132220ba6b469baedb/href">https://medium.com/media/e72d72e00fb5ac132220ba6b469baedb/href</a></iframe><p>With Gson, the Java Objects will represent the structure of the response JSON, and all associated data is easily retrieved through defined variables and methods. It’s as simple as that!</p><h3>Hurray, you did it!</h3><p>At this point, you should be a seasoned pro at integrating Foursquare’s powerful location intelligence into your next Android app!</p><p>Just to recap, this post walked through the basics of how to retrieve venues using the Foursquare API. Here’s a quick summary how to get started with Foursquare API.</p><ol><li>Become a Foursquare developer! Visit the <a href="https://developer.foursquare.com/">Foursquare for Developers</a> website and create a new app. You’ll be granted with a client ID and client secret, used to access the Foursquare API endpoints.</li><li>Where are you? You can use the <a href="https://developer.foursquare.com/docs/venues/search">venues/search</a> API endpoint with the limit=1 parameter to “snap” yourself to the venue you’re at.</li><li>Coffee, please! Now, make a request with the <a href="https://developer.foursquare.com/docs/search/recommendations">search/recommendations</a> API endpoint with the intent=coffee parameter to find recommended coffee spots around you.</li><li>Easy peasy! Integrating the Foursquare API with Android is simple. Using libraries such as Retrofit and Gson can greatly help with the heavy-lifting of managing HTTP connections and JSON parsing, so that you can focus on designing the next big app.</li></ol><p>If you ever run into a snag with the Foursquare API, please feel free visit the <a href="https://developer.foursquare.com/">Foursquare for Developers</a> website for documentation on the endpoints.</p><p>Need a shiny ‘Powered by Foursquare’ logo for your app? Check out the <a href="https://foursquare.com/about/logos">Foursquare Press Kit</a> for some resources.</p><p>Interested in using Foursquare’s location intelligence for your business? Explore our products and solutions on the <a href="https://enterprise.foursquare.com/">Foursquare for Enterprise</a> website.</p><p>Now, go forth and develop! We look forward to seeing what you build with Foursquare!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*fw_fNQNpGtRhzA7ZjMjkRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87b5e5991f67" width="1" height="1"><hr><p><a href="https://medium.com/foursquare-developers/mr-jitters-for-android-87b5e5991f67">Mr. Jitters for Android</a> was originally published in <a href="https://medium.com/foursquare-developers">foursquare-developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#GoLang Support for OAuth]]></title>
            <link>https://medium.com/foursquare-developers/golang-support-for-oauth-c85c5e69270b?source=rss----49024f11af2---4</link>
            <guid isPermaLink="false">https://medium.com/p/c85c5e69270b</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[location-intelligence]]></category>
            <dc:creator><![CDATA[Foursquare API]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 20:11:53 GMT</pubDate>
            <atom:updated>2016-11-18T20:11:53.447Z</atom:updated>
            <content:encoded><![CDATA[<p>We recently made some changes to the sub-package <a href="https://godoc.org/golang.org/x/oauth2">OAuth</a> inside the programming language <a href="https://godoc.org/golang.org/x/oauth2">Go</a>, this makes it even easier to start building things with Foursquare.</p><p>Here is quick and simple guide to setting up Foursquare Authentication using Go and retrieving your Check-In history.</p><p>p.s. At any time you can jump to the full sample code on <a href="https://gist.github.com/garethpaul/f1787cfdc94cd0805aac082bce0f87c8">Github</a></p><h3>Getting Started</h3><p>Let’s setup a basic Go Server</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0164158abcfe74cc57f9373bacecce8/href">https://medium.com/media/f0164158abcfe74cc57f9373bacecce8/href</a></iframe><p>Now let’s setup a simple site to serve some HTML</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66e895113509b06b6e3c8c31a803f9dd/href">https://medium.com/media/66e895113509b06b6e3c8c31a803f9dd/href</a></iframe><p>The page, where we will click the login button from.</p><ul><li>The page handling redirection to Foursquare.</li><li>The callback page handling information we get from Foursquare.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fddaaf94ac94719dcff64d3c0e64098e/href">https://medium.com/media/fddaaf94ac94719dcff64d3c0e64098e/href</a></iframe><h3>Dependencies</h3><p>You will need the following dependencies</p><pre>go get -u golang.org/x/…</pre><h3>Writing the application logic</h3><p>Before starting remember to import the <em>golang.org/x/oauth2</em> package.<br>To begin with, let’s write the main page handler:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3717f4ac991c84819997363809913340/href">https://medium.com/media/3717f4ac991c84819997363809913340/href</a></iframe><p>Next you should <a href="https://foursquare.com/developers/register">register your app</a> and we will need to create a variable we’ll use for storing data and communicating with Foursquare and the <em>random state variable</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/46eb455a573eeb6d9955efe8f9d16155/href">https://medium.com/media/46eb455a573eeb6d9955efe8f9d16155/href</a></iframe><h4>Handling communication with Foursquare</h4><p>This is the code that creates a login link and redirects the user to it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cddd395bf88bd0b1f8bee33618db986a/href">https://medium.com/media/cddd395bf88bd0b1f8bee33618db986a/href</a></iframe><p>We use the <em>foursquareOauthConfig</em> variable to create a login link using the random state variable, and later redirect the user to it.</p><p>Now we need the logic that get’s the code after the user logs in and checks if the state variable matches:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/806d665e63eec52d49bf9dbfae385bd9/href">https://medium.com/media/806d665e63eec52d49bf9dbfae385bd9/href</a></iframe><p>Here is the full example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8e9e476545a4904b1d3e84bfe020434/href">https://medium.com/media/e8e9e476545a4904b1d3e84bfe020434/href</a></iframe><p>Finally to get started run:</p><pre>go run main.go</pre><p>For further information about our API visit <a href="http://developer.foursquare.com">developer.foursquare.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c85c5e69270b" width="1" height="1"><hr><p><a href="https://medium.com/foursquare-developers/golang-support-for-oauth-c85c5e69270b">#GoLang Support for OAuth</a> was originally published in <a href="https://medium.com/foursquare-developers">foursquare-developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>