Retrofit에서 Ktor로: 안드로이드 HTTP 클라이언트 마이그레이션
·
Android
Intro현재 진행 중인 안드로이드 프로젝트를 KMP(Kotlin Multiplatform)로 전환하기로 결정하면서, Android 의존성을 가진 라이브러리를 멀티플랫폼 환경에서 작동하는 라이브러리로 교체해야 했다. 그중에서도 HTTP 클라이언트를 Retrofit에서 Ktor로 마이그레이션한 과정을 작성하려고 한다. Retrofit은 OkHttp 위에 구축된 고수준 추상화 라이브러리이다. 인터페이스만 정의하면 구현체를 자동으로 만들어주는 편리함 때문에, KMP를 고려하지 않았던 프로젝트 초기에는 당연한 선택지였다. Ktor은 JetBrains에서 개발한 Kotlin과 Coroutines 기반의 비동기 프레임워크로, 멀티플랫폼 네트워킹을 지원한다.API 요청을 위해 Retrofit은 인터페이스만 만들면 되..
[Android] Safely Refreshing Tokens with Authenticator and Mutex
·
Android
When building an app with JWT-based authentication, handling Access Token refresh is essential.In particular, when multiple APIs are called at the same time, unexpected concurrency issues may arise during the refresh process. In this post, I’d like to share the troubleshooting experience I faced while working on my project.JWT Token SystemJWT authentication typically involves two types of tokens..
[Android] Improving BottomNavigation Fragment Switching Performance
·
Android
When implementing BottomNavigation in Android, one common decision is whether to switch fragments using replace or add + show/hide.This post documents my experience and reasoning when moving from the replace approach to add/show/hide for better performance and state preservation.The Original replace ApproachsupportFragmentManager.commit { setReorderingAllowed(true) replace(binding.fcvFragm..
[Android] When Exactly Is onPause() Called?
·
Android
Every time I study the Android activity lifecycle, the one callback that always feels vague and confusing is onPause().While I understand the theory behind it, I often get confused about when exactly this method gets called during actual development. What the Official Documentation SaysAccording to the Android official documentation:The system calls this method as the first indication that the u..