In General few apps require user location, there we can enter address in a edittext field but as to get much more flexibility we can fetch the current latitude and longitude details based on user location. i.e., we can fetch latitude and longitude values from gps based on location of user we fetch these values.


Many apps now a days like taxi apps which will show their cabs present locations based on these values and also there are many different types of usages.


So lets get started with Android Fetch Current Latitude and Longitude Values


Before getting further we will get values based on network provider also.

Now we need to check GPS is enabled or not


Now checking with Network



Checking with GPS



Now we will fetch the methods getLatitude and getLongitude  and show output in



And then



Here we are adding two textviews and a button to fetch values on click.





Adding required permission in manifest file like internet and access fine location.




Output :


If you like the tutorial do share and like us for more android tutorials.

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial On Textview Marquee Animation