I'm trying to get actual location. I readed and tried dozens of examples. But all ends with error.
Example:
val locationManager = context.getSystemService(LOCATION_SERVICE) as LocationManager
Ends with this error:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Context?
Or I tried this. But ActivityCompat
and content
are red in Android studio.
I tried xx versions but some error was always there.
I'm creating GPS tracker. I'm starting with simple location detection.
Do you know some example for Android studio 4.1.2?