0

This is my code for getting current location. If anyone knows a way of doing this, kindly help. I'm stuck.

    private fun enableMyLocation() {
        if (isPermissionGranted()) {
            if (ActivityCompat.checkSelfPermission(
                    this,
                    Manifest.permission.ACCESS_FINE_LOCATION
                ) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
                    this,
                    Manifest.permission.ACCESS_COARSE_LOCATION
                ) != PackageManager.PERMISSION_GRANTED
            ) {
                return
            }
            map.isMyLocationEnabled = true
        } else {
            ActivityCompat.requestPermissions(
                this, arrayOf<String>(Manifest.permission.ACCESS_FINE_LOCATION),
                REQUEST_LOCATION_PERMISSION
            )
        }
    }
James Z
  • 12,209
  • 10
  • 24
  • 44
Joel Kanyi
  • 81
  • 1
  • 7
  • You can't replace the blue icon with your custom icon, instead you should make the blue icon invisible and create your own custom marker then update the marker on location changed event listener. – Ali Babadi Dec 05 '21 at 07:50
  • please check this link [simmilar question](https://stackoverflow.com/questions/14826345/replace-default-android-maps-api-v2-change-mylocation-icon) – Mahdi Zareei Dec 05 '21 at 08:08
  • There is also an open feature request for this in Google's Public Issue Tracker. You can check it here: https://issuetracker.google.com/169729868 – jabamataro Dec 06 '21 at 04:58

0 Answers0