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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:41:03+00:00 2026-05-21T15:41:03+00:00

My location listener works when I am using the DDMS controls in the emulator

  • 0

My location listener works when I am using the DDMS controls in the emulator but when I deploy it onto the phone it no longer works. My code is as follows

public class hoosheerAndroidAct extends MapActivity implements LocationListener {
    /** Called when the activity is first created. */
    MapController mc;
    public static MapView gMapView = null;
    GeoPoint p = null;
    static double latitude, longitude;
    MyLocationOverlay myLocationOverlay;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen1);

        // Creating and initializing Map
        gMapView = (MapView) findViewById(R.id.mapview);
        p = new GeoPoint((int) (latitude * 1E6),
                (int) (longitude * 1E6));
        gMapView.setSatellite(true);
        gMapView.setBuiltInZoomControls(true);
        mc = gMapView.getController();
        mc.setCenter(p);

        mc.setZoom(11);
        myLocationOverlay = new MyLocationOverlay(this, gMapView);
        gMapView.getOverlays().add(myLocationOverlay);
        list = gMapView.getOverlays();
        list.add(myLocationOverlay);

        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 5.0f,
                this);

    }

methods implemented for implements LocationListener

public void onLocationChanged(Location location) {
        if (location != null) {
            GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6),
                    (int) (location.getLongitude() * 1E6));
            mc.animateTo(point);
            connect("http://api.foursquare.com/v1/venues.json?geolat="
                    + location.getLatitude() + "&geolong="
                    + location.getLongitude());
            Drawable marker = getResources().getDrawable(R.drawable.marker);
            gMapView.getOverlays().add(new SitesOverlay(marker));

        }
    }

    public void onProviderDisabled(String provider) {
        // required for interface, not used
    }

    public void onProviderEnabled(String provider) {
        // required for interface, not used
    }

    public void onStatusChanged(String provider, int status, Bundle extras) {
        // required for interface, not used
    }

    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

Is there anything I am missing? 🙁

  • 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-21T15:41:04+00:00Added an answer on May 21, 2026 at 3:41 pm

    Google maps will default to network location provider if the GPS is unable to find a signal so that test could return a location without a GPS signal. I would recommend GPS Status as a good free app. The only other thing I can think of is to make sure you have a clear view of the sky.

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

Sidebar

Related Questions

I'm using GPS to get my location but this code shows my location in
DDMS is not able to send location to the emulator. I have tried sending
In an app Im working on Im using a backoff pattern of different location
My SeekBar (slider) works just fine but, it increments/decrements by one's as I slide
I'm using CookSwing (http://cookxml.yuanheng.org/cookswing/) to build a Java Swing UI, but the site doesn't
i was made an geolocation application.. it was works successfully but always make a
window.location.href redirects the browser to stackoverflow.com when the button is clicked, but does not
My app needs location fixes on regular basis, even when the phone is not
I am trying to implement a gps location listener that will stay on and
I know that we can get the current location of Android device using getLastKnownLocation

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.