smart-location-lib
smart-location-lib copied to clipboard
It's not calling OnLocationUpdatedListener
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);
}
});
}
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
For me, it is calling only once. Where do I have to configure to constantly get the updates?
@mrmans0n , onLocationUpdated called only once, any suggestions?
P.S. setInterval(10L)
, I'm not moving though.