I have an activity when I click on a button it has to return a google map and while confirmation the fragment disappears and it shows a TextView in my activity containing the current address. I saw similar questions but they don't solve that particular issue.
Asked
Active
Viewed 418 times
-2
-
You don't need google maps to fetch user location. You need to use location manager class – Vivek Mishra Aug 28 '18 at 10:45
-
post your code @Maryam – EL TEGANI MOHAMED HAMAD GABIR Aug 28 '18 at 10:46
-
I haven't written a code yet for searching , i have created an activity containing a button and when I click on it it returns another activity , no special code – Maryam Aug 28 '18 at 10:56
-
you mean "current address" like "street A building B"? – Vadim Eksler Aug 28 '18 at 10:59
-
https://stackoverflow.com/questions/1513485/how-do-i-get-the-current-gps-location-programmatically-in-android – Faysal Ahmed Aug 28 '18 at 11:00
-
@VadimEksler yes that what I mean – Maryam Aug 28 '18 at 11:02
1 Answers
0
So you need to make to steps:
1) get location latlng via FusedLocationProviderClient like mFusedLocationProviderClient.getLastLocation().addOnSuccessListener()
Or mFusedLocationClient.requestLocationUpdates(...)
After getting Location location
:
2) Accessing adress,states from longitude amd lattitude with google API

Vadim Eksler
- 865
- 9
- 24