You are implementing LocationListener in your activity MainActivity. The call for concurrent location updates will therefor be like this:

mLocationClient.requestLocationUpdates(mLocationRequest, this);

Be sure that the LocationListener you're implementing is from the google api, that is import this:

import com.google.android.gms.location.LocationListener;

and not this:

import android.location.LocationListener;

and it should work just fine.

It's also important that the LocationClient really is connected before you do this. I suggest you don't call it in the onCreate or onStart methods, but in onResume. It is all explained quite well in the tutorial for Google Location Api: https://developer.android.com/training/location/index.html

Answer from HigiPha on Stack Overflow
🌐
Android Developers
developer.android.com › core areas › sensors and location › request location updates
Request location updates | Sensors and location | Android Developers
This document explains how to request regular updates about a device's location using the Fused Location Provider's requestLocationUpdates() method in Android.
🌐
Google
developers.google.com › google play services › fusedlocationproviderclient
FusedLocationProviderClient | Google Play services | Google for Developers
October 31, 2024 - The getCurrentLocation(CurrentLocationRequest, CancellationToken) API is designed with exactly this use case in mind. On the other hand, if repeated location updates are required, such as when tracking the user's location over time, requestLocationUpdates(LocationRequest, Executor, LocationListener) or one of its variants is better suited.
Top answer
1 of 2
40

You are implementing LocationListener in your activity MainActivity. The call for concurrent location updates will therefor be like this:

mLocationClient.requestLocationUpdates(mLocationRequest, this);

Be sure that the LocationListener you're implementing is from the google api, that is import this:

import com.google.android.gms.location.LocationListener;

and not this:

import android.location.LocationListener;

and it should work just fine.

It's also important that the LocationClient really is connected before you do this. I suggest you don't call it in the onCreate or onStart methods, but in onResume. It is all explained quite well in the tutorial for Google Location Api: https://developer.android.com/training/location/index.html

2 of 2
13

I use this one:

LocationManager.requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)

For example, using a 1s interval:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000,0,this);

the time is in milliseconds, the distance is in meters.

This automatically calls:

public void onLocationChanged(Location location) {
    //Code here, location.getAccuracy(), location.getLongitude() etc...
}

I also had these included in the script but didnt actually use them:

public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}

In short:

public class GPSClass implements LocationListener {

    public void onLocationChanged(Location location) {
        // Called when a new location is found by the network location provider.
        Log.i("Message: ","Location changed, " + location.getAccuracy() + " , " + location.getLatitude()+ "," + location.getLongitude());
    }

    public void onStatusChanged(String provider, int status, Bundle extras) {}
    public void onProviderEnabled(String provider) {}
    public void onProviderDisabled(String provider) {}

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000,0,this);
    }
}
🌐
MapLibre
maplibre.org › maplibre-native › android › api › -map-libre -native -android › org.maplibre.android.location.engine › -location-engine-proxy › request-location-updates.html
requestLocationUpdates
open fun requestLocationUpdates(@NonNull request: LocationEngineRequest, @NonNull callback: LocationEngineCallback<LocationEngineResult>, @Nullable looper: Looper)
🌐
Medium
medium.com › @jfunkekupper › android-12-requestlocationupdates-with-pendingintents-750d8b641700
Android 12 requestLocationUpdates with PendingIntents | by Joost | Medium
October 27, 2021 - TL;DR When requesting location updates using the FusedLocationProviderClient.requestLocationUpdates() with a PendingIntent for a BroadcastReceiver, use the PendingIntent.FLAG_MUTABLE for the Intent flag so that the provider can associate the necessary location update to the Bundle.
🌐
Milosev
milosev.com › home › android
Request location updates
November 30, 2025 - fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper()) For that I need locationRequest and locationCallback Both locationRequest and locationCallback I have declared as member variables:
Find elsewhere
🌐
Android Developers
developer.android.com › core areas › sensors and location › get the last known location
Get the last known location | Sensors and location | Android Developers
This is the recommended way to get a fresh location, whenever possible, and is safer than alternatives like starting and managing location updates yourself using requestLocationUpdates().
🌐
Medium
medium.com › @alrodiaz15 › google-maps-location-jetpack-compose-36cd3fa617a4
Google Maps & Location Jetpack Compose | by Alberto Rodríguez Díaz | Medium
July 10, 2023 - RequestLocationUpdates function returns a flow that emit a LatLng object with user’s location every 10 seconds.
🌐
Google
codelabs.developers.google.com › codelabs › while-in-use-location
Receive location updates in Android with Kotlin | Google Codelabs
March 27, 2026 - The requestLocationUpdates() call lets the FusedLocationProviderClient know that you want to receive location updates.
🌐
Medium
medium.com › @boobalaninfo › accessing-users-location-guide-android-2023-60a6f018a718
Accessing User’s Location Guide Android 2023 | by Boobalan Munusamy | Medium
June 22, 2023 - // Create a LocationManager instance val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager // Request location updates from GPS provider locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0f, locationListener) // Define a LocationListener to handle location updates val locationListener = object : LocationListener { override fun onLocationChanged(location: Location) { // Handle received location updates val latitude = location.latitude val longitude = location.longitude // ...
🌐
Big Nerd Ranch
forums.bignerdranch.com › android programming (3rd edition) › 33. locations and play services
requestLocationUpdates() needs to be in try/catch (Android Studio 3.0) - 33. Locations and Play Services - Big Nerd Ranch Book Forums
July 29, 2017 - For this chapter, I’m using my device and not an emulator, and I’m also using Android Studio 3.0 Canary 3. All the code works great except this part gives me error if I don’t put it in try/catch with SecurityException: LocationServices.FusedLocationApi .requestLocationUpdates(mClient, request, new LocationListener() { @Override public void onLocationChanged(Location location) { Log.i(TAG, "Got a fix: " + location); new SearchTask().execute(location); } }); Code now reads: if (h...
🌐
Meetmarigold
sdkdevelopers.meetmarigold.com › v1.5 › docs › android-location-updates
Android: Location Updates
// setup intent for BroadcastReceiver val locationServiceIntent = Intent(this, LocationBroadcastReceiver::class.java) // create pending intent for location services val locationIntent = PendingIntent.getBroadcast(this, requestCode, locationServiceIntent, PendingIntent.FLAG_UPDATE_CURRENT) // get FusedLocationProviderClient val locationProviderClient: FusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this) // setup location request val locationUpdateInterval: Long = 180000 // update interval in milliseconds val locationMaxUpdateInterval: Long = 300000 // max update i
🌐
GitHub
gist.github.com › mizutori › 75192abf0cf9e4e2a08c132110ce40e1
locationManager.requestLocationUpdates (in Kotlin) · GitHub
locationManager.requestLocationUpdates (in Kotlin) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
🌐
Hammerhead
support.hammerhead.io › hc › en-us › community › posts › 36705323933467
LocationManager no longer emitting values – Hammerhead
May 12, 2025 - Is there any reason why android.location.LocationManager.requestLocationUpdates() would stop emitting location data? It emits data just fine on K2, but K3 is not emitting anything. This post on git...
🌐
Esri Community
community.esri.com › t5 › arcgis-runtime-sdk-for-android-questions › why-doesn-t-locationdisplay-update-often › m-p › 363708
Why doesn't LocationDisplay update often? - Esri Community
January 13, 2021 - The AndroidLocationDataSource receives location updates form the Android framework's LocationManager. Internally it calls LocationManager.requestLocationUpdates() passing in the parameters that you have provided to the AndroidLocationDataSource constructor. The AndroidLocationDataSource does ...