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

  • SEARCH
  • Home
  • 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 7596997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:03:35+00:00 2026-05-30T22:03:35+00:00

I am fairly new to developing android apps. What I am trying to do

  • 0

I am fairly new to developing android apps. What I am trying to do is a button click event which will find your current location. It will will then display the name of the city and the current weather. I am planning on using weather2 as an API. Anyway i havent got the faintest idea to do this i have searched tutorials and all i can find is the use of the location manager which results in the latatude and longatude along with a google map. Could anyone tell me how i could use the gps to use the API instead?

  • 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-30T22:03:38+00:00Added an answer on May 30, 2026 at 10:03 pm

    Your question isn’t entirely clear. You can’t use the GPS to use an API, you write code to use an API…

    That being said, it looks like using weather2 requires simply that you send an HTTP GET request to it. To actually call into their client you will use an HttpClient (included in Android’s library). You can find some bits of example code to do this here:

    timewasted dot net/?p=127

    The query you give it will follow these guidelines:

    http://www.myweather2.com/developer/apis.aspx?uref=becda844-8299-4bf6-899b-d771a92b9dbf

    One of the parameters that you can send to this API is your current longitude and latitude. You can use the locationmanager to obtain this. You will do a Context.getSystemService to get a LocationManager object, and then request that it inform you where you are. You might also resort to using LocationManager.getLastKnownLocation if the update never happens (this could happen, for instance, if the user is inside a building). You can find a simple LocationManager tutorial here:

    blogoscoped dot com/archive/2007-11-19-n27.html

    The Location object that you get back in your listener will tell you the latitude and longitude that you want, and you can package this up as a query to send to weather2. For example, here is a query string you could send to weather2 (using the HttpClient and GET request I mentioned above):

    http://www.myweather2.com/developer/forecast.ashx?uac=&query=24.15,56.32&temp_unit=f

    Here you could replace those coordinates with the ones you get from your LocationManager instead.

    Remember that the link I gave is not entirely correct. You should not perform network operations in the main thread of an application. Instead you should perform in something like an AsyncTask, a Service, etc.. and then use a Messenger to talk between the two (using AsyncTask simplifies this, however..)

    Sorry, you’ll have to replace the ‘dot’s with actual periods, as I have a low reputation 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to Android developing, and I've been assigned to make an app
I'm fairly new to .Net... I have several queries which will execute when the
I'm fairly new to developing in Android and I'm not sure how to solve
Being fairly new to objective-c and developing for ios I'm trying to figure out
I fairly new to JQuery and perhaps trying to achieve something that might be
I'm fairly new to ASP.NET and trying to learn how things are done. I
I am fairly new to Emacs and I have been trying to figure out
I'm fairly new to the Android platform and was wondering if I could get
I'm fairly new to Cocoa and Objective-C. Currently I'm developing a fairly basic application
I am developing a GWT app (I'm fairly new to GWT so this is

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.