본문 바로가기

jetpack11

[Android] Compose에서 BindService 사용하기 https://developer.android.com/develop/background-work/services/bound-services 바인딩된 서비스 개요  |  Background work  |  Android Developers이 페이지는 Cloud Translation API를 통해 번역되었습니다. 바인딩된 서비스 개요 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 바인드된 서비스란 클라이언트-developer.android.com가끔씩 앱이 실행중이지 않을 때 앱이 백그라운드에서 무언가 작업이 실행되어야 하는 경우가 있습니다.예를 들면 만보기, 파일 업로드/다운로드, 음악 플레이어 등과 같은 것들이 있습니다.이런 것들은 보통 서비스를 활용해서 구현하게 됩니다... 2025. 3. 20.
Android - DataStore로 SharedPreferences를 대체하자. 어플리케이션을 개발하다보면 앱 내부에 데이터를 저장해야 할 때가 있다. 그 중에서 어떤 유저가 특정 기능을 활성화 했는지 여부와 같이 굉장히 작은 규모의 데이터가 저장되어야 할 때가 있다. 이럴때 우린 SharedPreferences를 사용해서 저장하곤 했다. 하지만 SharedPreferences는 여러가지 단점이 있다. UI쓰레드에서 호출하기에 안전하지 않고, 예외나 런타임 안정성 등이 있다. 그리고 비동기 API에 대한 대응도 부족한 편이다. 이런 단점 때문인지, 구글에서 이를 보완하기 위해 Jetpack DataStore를 개발하였다. https://developer.android.com/topic/libraries/architecture/datastore?hl=ko 앱 아키텍처: 데이터 영역 -.. 2023. 7. 7.
Android - Deep dive into LiveData - 4. MediatorLiveData 이전 포스팅에서 Transformations를 사용하여 LiveData를 다른 LiveData로 변화시켰다. 이번 포스팅은 Transformations 내부에서 사용한 MediatorLiveData에 대해 알아본다. https://developer.android.com/reference/android/arch/lifecycle/MediatorLiveData MediatorLiveData | Android Developers Stay organized with collections Save and categorize content based on your preferences. The android.arch Architecture Components packages are no longer maintain.. 2023. 4. 1.
Android - Deep dive into LiveData - 3. Transformations(map, switchMap) LiveData를 사용할 때 LiveData가 변경되었을 때 값을 수신하고 다른 형태의 데이터로 변환해야 하는 경우가 있다. 예를들면 아래와 같은 상황을 보자. data class User( val firstName: String, val lastName: String, val nickName: String, ... ) private val _userLiveData: MutableLiveData = MutableLiveData() User 객체를 얻어왔을 때, UI에는 firstName과 lastName만을 수신해야한다고 가정해보자. Activity/Fragment에서 User를 UI에서 가공해야 할까? 이는 바람직하지 않다. 왜냐하면 데이터의 가공은 ViewModel 레이어에서 이루어지고, UI는 단지.. 2023. 1. 28.
반응형