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 6646737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:27:11+00:00 2026-05-26T00:27:11+00:00

I’ve looked at a few other questions and tutorials but I’m not getting what

  • 0

I’ve looked at a few other questions and tutorials but I’m not getting what I’m looking for

I am trying to get the latitude and longitude in this format

latitude = 40.769134 , longitude = -73.960905

I implemented this class which takes my global variables latitude and longitude (they are long data types)

 class GpsListener implements LocationListener{

        public void onLocationChanged(Location location) {
              // TODO Auto-generated method stub
              latitude = location.getLatitude();
              longitude = location.getLongitude();
              //float speed = location.getSpeed();
              checkin();

        }

        public void onProviderDisabled(String provider) {
              // TODO Auto-generated method stub

        }

        public void onProviderEnabled(String provider) {
              // TODO Auto-generated method stub

        }


        @Override
        public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
            // TODO Auto-generated method stub

        }

}

I’ve looked at other tutorials here and notice that people use the LocationManager class to interface with my LocationListener but all I really need to do is use a Location object becuase my class GpsListener.onLocationChanged(.. ) needs a location object, but can you give an example or guidance on how to use the location object or how to simply get this longitude and latitude?

I am simply passing the latitude and longitude to a server so I dont need to do anything else with the GPS module, my checkin() function makes the server call

  • 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-26T00:27:12+00:00Added an answer on May 26, 2026 at 12:27 am

    are you trying to avoid using the LocaitonManager?

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MINIMUM_TIME_BETWEEN_UPDATES,MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,new MyLocationListener());
            location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); 
    

    if you just want to use it once, I suppose you could deregister everything after receiving a location. But maybe you want to make sure the accuracy is within x meters etc..

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.