본문 바로가기
[android studio] Could not find lint-gradle-api.jar 해결 방법 - jcenter 와 google 이 repositories 에 추가되었음에도.. 아래와 같은 에러 메시지를 마딱뜨렸다. Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar - 나의 순서는 아래와 같았다. repositories{ jcenter() google() } 이를 아래와 같이 순서를 바꾸어주니 해결.... repositories{ google() jcent.. 2023. 1. 6.
[android] Runtime permission group 에 대한 이야기 - Permission group 과 개개의 permission 의 관계가 명확치 않아서 정리해보았다. - 우선 permission 요청은 group 단위가 아닌 개개 permission 단위이다. 예를 들어 READ_PHONE_STATE 만 permission 을 요청하고 grant 해도 Settings 에서는 CALL group 에 대한 permission 이 grant 된 것으로 표시된다. 비록 CALL permission group 은 ON 으로 되었지만, READ_CALL_LOG 등과 같이 grant 하지 않은 permission 을 사용하려고 하면 SecurityException 이 발생한다. - 그럼 Settings 에서 CALL permission group 을 ON 시키면 permissi.. 2022. 12. 31.
[android] implicit broadcast - signature permission or FLAG_RECEIVVER_INCLUDE_BACKGROUND - 안드로이드 가이드에 따르면 targetSdk 를 oreo 이상으로 설정할 경우, implicit broadcast 에 발송에 대해 (대상이 명확하지 않은 broadcast) static receiver 의 경우 수신할 수 없고, dynamic receiver 의 경우 수신할 수 있다. ( 물론, 일부 broadcast 는 예외적이다. https://developer.android.com/guide/components/broadcast-exceptions ) - Oreo 소스 기준 BroadcastQueue.java 의 processNextBroadcast 를 보면 아래 코드가 있다. // ... else if (((r.intent.getFlags()&Intent.FLAG_RECEIVER_EXCLUDE.. 2022. 12. 30.
[android] StrictMode 에 대해 다시 한번 알아보자 - http://aroundck.tistory.com/3429 Android StrictMode Android StrictMode 출처http://code.tutsplus.com/tutorials/android-best-practices-strictmode--mobile-7581http://developer.android.com/reference/android/os/StrictMode.html - android strict mode 는 2가지 category 가 있다. 하나는 thread policy 이 aroundck.tistory.com http://aroundck.tistory.com/2074 [android] Strict Mode 에 대해 알아보자. 안드로이드, Strict Mode 에 대해 알아.. 2022. 12. 29.
[android] FilePath 에 대한 이야기 - API 를 통해 FilePath 를 가져올 때 absolute path 정보가 조금 아리까리하다. 그래서 FilePath return 을 정리하여 감을 잡기 쉽게 하기 위해 이 글을 적어본다. - 아래 path 에 data/user/0 = data/data 이다. (main user 일 경우) - https://developer.android.com/reference/android/content/Context.html#getDir(java.lang.String,%20int) Context.getDir(, MODE_PRIVATE) /data/user/0//app_ - https://developer.android.com/reference/android/content/Context.html#getFile.. 2022. 12. 28.
[android] ListView, RecyclerView 에서 top position 인지 판단하는 방법 - canScrollVertically 를 이용하면 된다. - scrollView.setOnScrollChangeListener{ _, _, _, _, _ -> if(scrollView.canScrollVertically(-1)){ // it’s not top yet } else{ // it’s top } } 끝 2022. 12. 27.
[android] AudioFocus 관리하기 - 2개 이상의 앱이 audio 를 하나의 stream 으로 동시에 재생할 수 있다. 시스템은 이들을 믹스한다. 이는 유저에게 소음이 될 수 있다. 이를 예방하기 위해서 "Audio Focus" 라는 개념을 도입했고, 하나의 앱만 audio focus 를 가질 수 있다. - 앱이 audio output 을 하려면, audio focus 를 요청해야 한다. focus 를 획득하면 소리를 재생할 수 있다. audio focus 를 획득한 후에 재생을 끝마칠 때까지 focus 를 유지하지 못 할 수 있다. 다른 앱이 focus 를 요청하여 취득하는 경우가 그 경우이다. Focus 를 잃으면 재생을 중단하거나, 볼륨을 줄이는 작업 등을 통해 유저가 새로운 audio 를 잘 들을 수 있게 협조해야 한다. - An.. 2022. 2. 14.
[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] Kotlin and Flow usage # Flow 는 'emit' 으로 data 를 발행하고, 'collect' 로 data 를 받아본다. # DataStore, Retrofit, Room, WorkManager 등에서 Flow 를 지원하고 있다. # flow builder 로 flow 를 쉽게 만들 수 있으며 이 녀석은 suspend block 을 받는다. # collect 역시 suspend block 을 받는다. # final operator 가 지정되기 전까지 flow 는 emit 하지 않으며, downstream 순서대로 로직이 수행된다. # Android UI 에서 collect 를 사용하기 위해서는 아래와 같은 방법이 사용된다. Flow.asLiveData():LiveData // 아래 2개를 추천함 Lifecycle.repea.. 2022. 1. 31.
반응형