What is Fused location API?
Using the Google Play services location APIs, your app can request the last known location of the user’s device.
In most cases, you are interested in the user’s current location, which is usually equivalent to the last known location of the device.
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 level, like high accuracy or low power.
It also optimizes the device’s use of battery power.
How to Set Up Google Play Services?
To access the fused location provider, your app’s development project must include Google Play services.
Add this dependency in build.gradle
What are all the Permissions needed?
Apps that use location services must request location permissions.
ACCESS_FINE_LOCATION : The permission you choose determines the accuracy of the location returned by the API.
ACCESS_COARSE_LOCATION:If you specify
ACCESS_COARSE_LOCATION, the API returns a location with an accuracy approximately equivalent to a city block.
Find Android code in this Github Link
Result of above app