Skip to content

False positive when accessing the location #3

@BenLscr

Description

@BenLscr

I was working with permissionskt sinceone year and know the lint give a false postive when accessing the location.

askPermissions(
            Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.ACCESS_COARSE_LOCATION
        ) {
            onGranted {
                val fusedLocationClient =
                    LocationServices.getFusedLocationProviderClient(this@HomeActivity)
                fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
                    if (location != null) {
                        
                    } else {
                        showSnackBar("No location")
                    }
                }
            }
        }

fusedLocationClient.lastLocation is completely red because android studio tell you to asking for permissions.
For the moment i have added @SuppressLint("MissingPermission") on my function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions