Hi I'm trying to figure out how to change the city, based on the current location.Is there a way I can manipulate "{city}"? This is probably a really easy question. As of current, my app is aware of device location but I don't know how to manipulate the url. Should I use a different api?
interface ApiService {
@GET("weather/{city}")
suspend fun getWeather():Response<Weather>
}
You can use @Path for this.
For example:
@GET("weather/{city}")
suspend fun getWeather(@Path("city") val city: String):Response<Weather>
Now, when you call the function. Pass the string to dynamically update "city".