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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:44:00+00:00 2026-06-14T10:44:00+00:00

I am using Location Manager for getting the current longitude and latitude, but in

  • 0

I am using Location Manager for getting the current longitude and latitude, but in an emulator I am getting an error. How do I get locations on emulator?

This is my code:

lm = (LocationManager) context
    .getSystemService(Context.LOCATION_SERVICE);
    android.location.Location currentLocation = lm
    .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    if (currentLocation == null)
        currentLocation = lm
        .getLastKnownLocation(LocationManager.GPS_PROVIDER);

    if (currentLocation != null) {
        currentLongitude = currentLocation.getLongitude();
        currentLatitude = currentLocation.getLatitude();

        // Get last location of driver
        lastLongitude = Double.valueOf(app.GetLongitude(context));
        lastLatitude = Double.valueOf(app.GetLatitude(context));
        distance = CommonFunctions.GetDistance(currentLongitude,
                currentLatitude, lastLongitude, lastLatitude);
}
  • 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-06-14T10:44:01+00:00Added an answer on June 14, 2026 at 10:44 am

    You’ll find this window in the DDMS perspective in Eclipse. This way you can test your application with various location values.

    enter image description here

    Follow below steps to set mock values:

    go to eclipse DDMS perspective,Via

    Windows>Open Perspective > other > DDMS (You can type to filter the list)

    find Emulator Control tab

    then inside Location Control box

    You can send lat, long to emulator to simulate gps changes.

    if you cannot find Emulator Control, just open it via:

    Windows > show view > other > Emulator Control (You can type to filter the list)

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

Sidebar

Related Questions

When using a Location Manager to get a Location object containing Latitude and Longitude,
Im using this code for getting the location for my app: LocationManager lm =
I am trying to get the user's current latitude/longitude, using the following code :
I'm trying to get my location using it like this: LocationManager myLocationManager = (LocationManager)
I am using the following code to get the current location,I have added the
I want to find the current latitude and longitude of current location but both
I am using location manager in my application and i'm getting inaccurate location.I'm using
Ok, this is a really weird one. I'm sending Latitude/Longitude to Emulator running my
I am usin location service for getting latitude and longitude of my location.While running
I am using following code in viewDidLoad method CLLocationManager *locationManager = [[CLLocationManager alloc] init];

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.