본문 바로가기
[kotlin] CoroutineContext 에 대한 이해 - Kotlin coroutine 의 핵심은 CoroutieContext interface 이다. 모든 launch, async 같은 coroutine builder 는 첫번째 param 으로 CoroutineContext 를 받는다. 이 coroutine builder 들은 CoroutineScope interface 의 extension function 으로 정의되어 있으며, abstract read-only property 로 coroutineContext 를 가지고 있다. - fun CoroutineScope.launch( context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT,.. 2022. 2. 3.
[android] Pie (9) 의 Power management [android] Pie (9) 의 Power management https://developer.android.com/about/versions/pie/power -Android 9 (API 28) 에서는 전원 관리를 위한 새로운 feature 가 추가되었다.이 전원 관리 기능은 2가지 카테고리로 나뉜다. 1. App standby buckets 시스템이 단말의 CPU, 배터리 등의 리소스 사용을 유저의 사용 패턴에 의해 제한한다. 2. Battery saver 개선 Battery saver 가 켜져 있을 때 시스템이 모든 앱에 대해 제한을 건다. 이건 기존에 있던 기능인데, Pie(9) 에서 개선되었다. * App Standby Buckets -얼마나 최근에 얼마나 자주 앱이 사용되었는지에 대한 유저.. 2019. 7. 29.
[coroutine] exception 을 이해해보자 #2 ( in global scope ) -[coroutine] exception 을 이해해보자 #1 ( in my coroutine scope ) 과 동일한 sample 들을 직접 생성한 coroutine 이 아닌 GlobalScope 에서 수행해보기로 했다.혹시나 뭔가 동작이 다를까 해서..내가 알고 있기로는 GlobalScope 은 defaultHandler 가 setting 되어 결국 모든 exception 을 먹어 crash 가 나지 않는다는 차이만 있는것으로 알고 있는데.. 검증해보자 ( 결론은 잘못 알고 있었다. ) -class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState).. 2019. 3. 6.
[Coroutine] Coroutine context and dispatchers https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/coroutine-context-and-dispatchers.md#thread-local-data -기존에 있었던 doc 이 update 되어서 따로 정리한다. Coroutine context and dispatchers -Coroutine 은 항상 어떤 context 하에서 실행된다.이 context 는 CoroutineContext type 을 가지며 Kotlin standard lib 에 정의되어 있다. -Coroutine context 는 여러개의 element 들을 가진 set 이다.main element 는 coroutine 의 Job, dispatcher 이다. Dispatchers.. 2019. 2. 8.
[Kotlin] Coroutines tutorial - async code 쉽게 짜기 [Kotlin] Coroutines tutorial - async code 쉽게 짜기 https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md -Kotlin coroutines 는 async code 를 sync code 의 구조를 바꾸지 않고 짤 수 있게 도와준다. Coroutine Basics - modified내용이 바뀌어서 새로 정리하였습니다. -> Coroutine Basics ( 코루틴 기초 ) 예전 기록을 보고 싶으시면 아래 "더보기" 버튼을 눌러주세요!Hello World Coroutine -launch{ delay(1000L) println(“World!”)}println(“Hello,”)Thread.slee.. 2018. 11. 25.
[android] Doze 모드와 App standby 모드 + GCM High priority message [android] Doze 모드와 App standby 모드 + GCM High priority message https://developer.android.com/training/monitoring-device-state/doze-standby.html -MOS ( 6.0 ) 부터 등장 Doze 모드 -device 가 unplug 된 상태로 오랜 시간 움직여지지 않으면 screen 이 꺼지고, 이 상태에서 시간이 지나면 Doze(깜빡 잠이 들다, 졸다) 모드에 들어간다. -Doze mode 에서는 device 는 주기적으로 아주 짧은 시간동안 resume 되어 보통의 operation 들을 수행한다.이 resume time 에는 app sync 나 pending operation 을 수행하곤 한다. -.. 2017. 9. 17.
반응형