w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Google location service updates ignoring location listener (android)

Typically right before I call and use GoogleMap I instantiate the supportfragmentmanager then use this to instantiate the map. Like below I hope this helps.

    lm = (LocationManager)
    SupportMapFragment mf= (SupportMapFragment)

    map = mf.getMap();

    //map = ((MapFragment)
    ll = new SecondPointLocationListener();

As far as your method for printing the location use this instead...

public void onConnected(Bundle arg0) 
    Toast.makeText(context, "GPS connected", Toast.LENGTH_SHORT).show();
    connector = new Connector();
    connector.execute("clues", null, null);
    listener = new LocationListener()
        public void onLocationChanged(Location location) 
            Log.d("location", "listener activated");
            double[] coords = locationCoords(location);
            if(coords[0] != 0)
LatLng(coords[0], coords[1]), (float) 14.5));


            Double latitude = location.getLatitude();
            Double longitude = location.getLongitude();
            Toast.makeText(context,"Latitude = "+ latitude + "" +"Longitude
 "+ longitude,
            catch(NullPointerException e)
                Log.d("nulls", "null");

    mLocationClient.requestLocationUpdates(mLocationRequest, listener);
    Log.d("location", "location updates initiated");

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.