smart-location-lib icon indicating copy to clipboard operation
smart-location-lib copied to clipboard

It's not calling OnLocationUpdatedListener

Open freebumba27 opened this issue 8 years ago • 3 comments

It's never calling OnLocationUpdatedListener even I have added checking because I am testing it in >23

   if (ContextCompat.checkSelfPermission(this,
    != PackageManager.PERMISSION_GRANTED) {
    != PackageManager.PERMISSION_GRANTED) {
        SmartLocation.with(this).location()
                .oneFix()
                .start(new OnLocationUpdatedListener() {
                    @Override
                    public void onLocationUpdated(Location location) {
                        lat = location.getLatitude();
                        lng = location.getLongitude();
                        Log.d("TAG", "onLocationUpdated: lat: " + lat + " lng: " + lng);
                    }
                });
    }

freebumba27 avatar Feb 03 '17 03:02 freebumba27

   if (ContextCompat.checkSelfPermission(this)   == PackageManager.PERMISSION_GRANTED) {
        SmartLocation.with(this).location()
                .oneFix()
                .start(new OnLocationUpdatedListener() {
                    @Override
                    public void onLocationUpdated(Location location) {
                        lat = location.getLatitude();
                        lng = location.getLongitude();
                        Log.d("TAG", "onLocationUpdated: lat: " + lat + " lng: " + lng);
                    }
                });

And you need to add onPermissionResult in your activity

joxad avatar Feb 03 '17 14:02 joxad

For me, it is calling only once. Where do I have to configure to constantly get the updates?

ghost avatar Feb 21 '17 07:02 ghost

@mrmans0n , onLocationUpdated called only once, any suggestions? P.S. setInterval(10L), I'm not moving though.

mecoFarid avatar May 22 '17 21:05 mecoFarid