unable to invoke tha getLocationweatherdetails(latitude,longitude) from ananymous class

31 Views Asked by At
/**
 * A function to request the current location. Using the fused location provider client.
 */
@SuppressLint("MissingPermission")
private fun requestLocationData() {

    val mLocationRequest = LocationRequest()
    mLocationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY
    mLocationRequest.interval = 1000
    mLocationRequest.numUpdates = 1

    mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this)

    mFusedLocationClient.requestLocationUpdates(
        mLocationRequest, mLocationCallback,
        Looper.myLooper()!!)

   // getLocationWeatherDetails(34.00,55.00)
}

/**
 * A location callback object of fused location provider client where we will
 * get the current location details.
 */
private val mLocationCallback = object : LocationCallback() {
    override fun onLocationResult(locationResult: LocationResult) {
        val mLastLocation: Location = locationResult.lastLocation
        val latitude = mLastLocation.latitude
        Log.i("Current_Latitude", "$latitude")

        val longitude = mLastLocation.longitude
        Log.i("Current_Longitude", "$longitude")

        //getLocationWeatherDetails(latitude, longitude)
        getLocationWeatherDetails(latitude,longitude)
    }
}
0

There are 0 best solutions below