October 22, 2024
Chicago 12, Melborne City, USA
Android

Caching API call data


I’m using Ktor to call API in my android app in kotlin and now I want to cache the response so that I can use app even if it is offline, how to do that ??

I have used HttpCache but that didn’t work

install(HttpCache) { val cacheFile = Files.createDirectories(Paths.get(System.getProperty("java.io.tmpdir"), "ktor_cache")).toFile() publicStorage(FileStorage(cacheFile)) }



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video