before get last location, maybe you want get current location, check if null or have. if not set last loccation if you want use FusedLocationProviderClient and before use it adding this:

implementation 'com.google.android.gms:play-services-location:16.0.0'

on your build.gradle(Module: app), and call method zoomMyCuurentLocation() whean activity create.

private void zoomMyCuurentLocation() {
    LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
    }
    Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
    if (location != null) {
        double lat = location.getLatitude();
        double longi = location.getLongitude();
        LatLng latLng = new LatLng(lat,longi);
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14.f));
        Log.d(TAG, "zoomMyCuurentLocation: location not null");
    } else {
        setMyLastLocation();
    }
}

private void setMyLastLocation() {
    Log.d(TAG, "setMyLastLocation: excecute, and get last location");
    FusedLocationProviderClient fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    fusedLocationClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() {
        @Override
        public void onSuccess(Location location) {
            if (location != null){
                double lat = location.getLatitude();
                double longi = location.getLongitude();
                LatLng latLng = new LatLng(lat,longi);
                Log.d(TAG, "MyLastLocation coordinat :"+latLng);
                mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14.f));
            }
        }
    });
}
Answer from rivaldy on Stack Overflow
🌐
Google Support
support.google.com › android › thread › 12865747 › my-devices-last-location-known
My devices last location known - Android Community
August 26, 2019 - Android · false · Search · Clear search · Close search · Google apps · Main menu · 1564977203837878192 · true · Search Help Center · false · true · true · true · true · true · 0 · false ·
🌐
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
Once you have created the Location Services client you can get the last known location of a user's device. When your app is connected to these you can use the fused location provider's getLastLocation() method to retrieve the device location.
Discussions

geolocation - How to get last known location for Location manager in Android? - Stack Overflow
To fetch the last location, you can refer to the above provided answers where you can use Location Manager or FusedLocationClient · But You can also make use of LocationServices which is faster than other approaches. ... implementation 'com.google.android.gms:play-services-maps:17.0.0' ... More on stackoverflow.com
🌐 stackoverflow.com
How do i get my last known location in android? - Stack Overflow
I am using google play services to get my last location. the project is working fine without force closing, however, it never gets any location. i assume it doesn't require GPS or Mobile network as More on stackoverflow.com
🌐 stackoverflow.com
How to view last locations on Google Find My Device ? - Android Community
Android Help · Sign in · Google Help · Help Center · Community · Android · Privacy Policy · Terms of Service · Submit feedback · Send feedback on... This help content & information · General Help Center experience · Next · Help Center · Community · Get started with Android · More on support.google.com
🌐 support.google.com
android - How to get last location of a device? - Stack Overflow
I am trying to get user's last known location but when i open the app it just shows a blank screen in the textViews where it should show latitude longitude and time. I can't find any flaws or error... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Android Central
forums.androidcentral.com › home › android os discussion & help › android 14
find last location of phone when it says "location unavailable" in "find my device" ? | Android Central Forum
May 7, 2025 - You'd have to use that option or "With network in all areas". This has to be set up per device. If you're using the Samsung-specific Find My Mobile, then the last location will only be sent if the opt-in toggle was activated on that device.
🌐
JustAnswer
justanswer.com › android-devices › ap1zs-lost-device-died-device-manager-not-showing-last.html
How to Find Last Known Location of Your Android Device - Expert Q&A
If Android Device Manager doesn’t show your device’s last location, verify the device is online and location services are enabled. Check Google Maps Timeline for recent location data. Ensure the device has an active internet connection and ...
🌐
Quora
quora.com › How-do-I-find-out-where-my-last-location-is-on-my-Android-phone-that-is-connected-to-my-Google-account
How to find out where my last location is on my Android phone that is connected to my Google account - Quora
Answer: You can use the Android Device Manager android App. Or, you could use the Find My Device option to locate the device. Use these options if you’ve lost your device(provided the location is turned on in the device).
Top answer
1 of 9
6

before get last location, maybe you want get current location, check if null or have. if not set last loccation if you want use FusedLocationProviderClient and before use it adding this:

implementation 'com.google.android.gms:play-services-location:16.0.0'

on your build.gradle(Module: app), and call method zoomMyCuurentLocation() whean activity create.

private void zoomMyCuurentLocation() {
    LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
    }
    Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
    if (location != null) {
        double lat = location.getLatitude();
        double longi = location.getLongitude();
        LatLng latLng = new LatLng(lat,longi);
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14.f));
        Log.d(TAG, "zoomMyCuurentLocation: location not null");
    } else {
        setMyLastLocation();
    }
}

private void setMyLastLocation() {
    Log.d(TAG, "setMyLastLocation: excecute, and get last location");
    FusedLocationProviderClient fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    fusedLocationClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() {
        @Override
        public void onSuccess(Location location) {
            if (location != null){
                double lat = location.getLatitude();
                double longi = location.getLongitude();
                LatLng latLng = new LatLng(lat,longi);
                Log.d(TAG, "MyLastLocation coordinat :"+latLng);
                mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14.f));
            }
        }
    });
}
2 of 9
4

Silly thing as answer to this ...I restarted my device ...and it worked...Please ensure that your service for location are enabled and working properly

🌐
Android Developers
minimum-viable-product.github.io › marshmallow-docs › training › location › retrieve-current.html
Getting the Last Known Location | Android Developers
Specifically, use the fused location provider to retrieve the device's last known location. The fused location provider is one of the location APIs in Google Play services. It manages the underlying location technology and provides a simple API so that you can specify requirements at a high ...
Find elsewhere
🌐
Google Support
support.google.com › android › thread › 79656753 › how-to-view-last-locations-on-google-find-my-device
How to view last locations on Google Find My Device ? - Android Community
Android · false · Search · Clear search · Close search · Google apps · Main menu · 17547299067108420611 · true · Search Help Center · false · true · true · true · true · true · 0 · false ·
🌐
Asurion
asurion.com › connect › tech-tips › how-to-easily-find-your-lost-android-phone
Find My Android: How to Locate Your Lost Phone Fast
April 21, 2026 - Panicking about a lost phone? Use our guide to Find My Android to locate, lock, or erase your device quickly using Google and Samsung tools.
🌐
Quora
quora.com › How-do-I-find-an-Android-phone’s-last-location
How to find an Android phone’s last location - Quora
Answer (1 of 2): So you can see that it synced but not its location? That’s peculiar. Maybe location was deactivated. You _should_ be able see the last position while the phone was logged in to your account (and synced). A new user would log in with their credentials, so then no more data ...
🌐
Infobae
infobae.com › breaking news
How to know the last location of an Android phone or iPhone if it was stolen, even if it is turned off - Infobae
April 17, 2022 - It is important to note that 'Where's My Droid' has other very useful functions, the problem is that ... 1. If you lost your phone and you want to know what its last location was, you have to go to the official page of 'Where's My Droid'.
🌐
MakeUseOf
makeuseof.com › home › android › how to find a lost android phone that is turned off
How to Find a Lost Android Phone That Is Turned Off
May 7, 2024 - Here's how you can track your lost and powered-off Android phone's location using Find My Device on the web: Visit Google's Find My Device website on a computer or another phone. Log in with the same Google account as the one on your stolen ...
🌐
AirDroid
airdroid.com › home › parent control › how to find a dead phone? [iphone & android]
How to Find a Dead Phone? [iPhone & Android]
August 3, 2022 - Go to android.com/find and log in from your Google account. Once logged in, Find My Device will attempt to locate your phone. If successful, it will display your phone's last known location on a map.
🌐
Android
android.com › learn-find-hub
Find Your Phone with Find Hub: Locate Devices & Share - Android
2 days ago - Easily locate your devices on a map. You can find them even if they’re offline¹ or on silent. ... Pull up the map view to see where your belonging was last located.
🌐
JustAnswer
justanswer.com › android-devices › h2sfc-track-phones-last-location-lost.html
Is there a way to track my phones last location. I lost my phone about 3 months ago, but because of my recent divorce I
Tracking a phone without GPS is challenging since location services rely on it. Alternative methods include using the phone’s last known location via network triangulation from cell towers or Wi-Fi connections, accessible through carrier services or Google’s Find My Device if previously enabled.
🌐
Google Support
support.google.com › android › thread › 273502207 › i-am-unable-to-see-the-last-known-location-of-my-devices
I am unable to see the last known location of my devices - Android Community
May 8, 2024 - Android · false · Search · Clear search · Close search · Google apps · Main menu · 7261248061760437706 · true · Search Help Center · false · true · true · true · true · true · 0 · false ·
🌐
Quora
quora.com › What-does-it-mean-when-a-location-search-of-a-lost-Android-phone-says-Last-seen-X-days-ago-but-today-it-says-Cant-reach-phone
What does it mean when a location search of a lost Android phone says, 'Last seen X days ago,' but today, it says 'Can't reach phone'? - Quora
If the location is on, first try to locate using Google. Often it can provide a radius of where it was “last seen” -or pinged their service- and you can search from there. Perhaps knowing the general a... ... Sr. Developer and Business Owner (1997–present) · Author has 8.7K answers and 37.6M answer views · 7y · Originally Answered: My phone is lost, and it's possible that it was taken by someone already. But the phone is still on my Android ...