Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3277676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:23:45+00:00 2026-05-17T19:23:45+00:00

I am planning to develop a very simple java application (not mobile, but desktop

  • 0

I am planning to develop a very simple java application (not mobile, but desktop apps) that utilizes web services, specifically Foursquare API and Google Map Web Service. I plan to get the users address and then using Google Map to translate the address to lattitude and longitude then feed this result to foursquare API method Venue methods (Nearby and search) to get a results of nearby venues and show it to users. The question are:

  1. Is this all do able in Java?
  2. How do I call such http://api.foursquare.com/v1/venues in java and get the result? I know I can use Xpath to parse the result. I am just not sure on how to call those post
    methods in java and pass in parameters to it.
  3. Is there any sample java code that uses foursquare API out there?
  4. Will the foursquare API work if it’s used not on mobile?

Sorry for all the noob questions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:23:45+00:00Added an answer on May 17, 2026 at 7:23 pm
    1. Yes, it’s possible, but I don’t know the FourSquare API well enough to answer with 100% confidence.
    2. Make a URL connection to that URL and create a GET or POST request that conforms to their API.
    3. Google is your friend.
    4. You can certainly make HTTP requests. It’s another matter what you do with the results.

    UPDATE:

    I’m not signed up at FourSquare. Try this out and let me know if it works for you:

    package foursquare;
    
    import java.io.*;
    import java.net.Authenticator;
    import java.net.URL;
    
    /**
     * FourSquareDemo
     * User: Michael
     * Date: 10/19/10
     * Time: 7:53 PM
     */
    public class FourSquareDemo
    {
        private static final int DEFAULT_CAPACITY = 4096;
        private static final String DEFAULT_URL = "http://api.foursquare.com/v1/";
        private static final String DEFAULT_EMAIL = "you@gmail.com";
        private static final String DEFAULT_PASSWORD = "password";
    
        public static void main(String[] args)
        {
            long startTime = System.currentTimeMillis();
            long endTime = 0L;
            try
            {
                String downloadSite = ((args.length > 0) ? args[0] : DEFAULT_URL);
                URL url = new URL(downloadSite + "history");
                Authenticator.setDefault(new BasicAuthenticator(DEFAULT_EMAIL, DEFAULT_PASSWORD));
                String contents = readFromUrl(url);
    
                PrintStream ps = ((args.length > 1) ? new PrintStream(new FileOutputStream(new File(args[1]))) : System.out);
                printToStream(ps, contents);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
            finally
            {
                endTime = System.currentTimeMillis();
                System.out.println("wall time: " + (endTime - startTime) + " ms");
            }
        }
    
        private static void printToStream(PrintStream ps, String contents) throws IOException
        {
            ps.println(contents.toString());
            ps.close();
        }
    
        private static String readFromUrl(URL url) throws IOException
        {
            StringBuilder contents = new StringBuilder(DEFAULT_CAPACITY);
    
            BufferedReader br = null;
    
            try
            {
                InputStream is = url.openConnection().getInputStream();
    
                br = new BufferedReader(new InputStreamReader(is));
                String line;
                String newline = System.getProperty("line.separator");
                while ((line = br.readLine()) != null)
                {
                    contents.append(line).append(newline);
                }
            }
            finally
            {
                try
                {
                    if (br != null)
                    {
                        br.close();
                    }
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
    
            return contents.toString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.