본문 바로가기

728x90
반응형

Android

(80)
[안드로이드] 화면 꺼짐 방지 코드 Kotlin window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) Java getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); onCreate() 에 추가
안드로이드 Clean Architecture 구현하기 Clean Architecture 위의 Uncle Bob Clean Architecture(CA)는 오늘날 많은 어플리케이션의 핵심 Architecture가 되었습니다. Dependecy Rule 하위 계층으로 갈수록 상위 계층을 몰라야 합니다. 내부 원의 어떤것도 외부 원의 어떤것에 대해 전혀 알 수 없습니다. 특히, 외부 원에 선언된 이름(class, function, variable 등)은 내부 원에 있는 코드에서 언급되지 않아야 합니다. CA의 각 계층 Entities : 비지니스 규칙(business rule) (예: 근무시간에 따라 급여를 계산하는 공식, 직원에 대한 가장 기본적인 데이터가 들어있는 POJO) Use cases : 단순히 실행 가능한 작업. Intereactor라고도 함. an..
안드로이드 스튜디오 Warning : It seems you're using 'idea.system.path' property... It seems you're using 'idea.system.path' property to specify the location of the caches directory. In 2020.1, default locations of application directories were changed. For compatibility, the IDE picked the old location of logs, but to avoid any ambiguity in the future (and to get rid of this warning) please set 'idea.log.path' property, too. Shift 키를 두번 눌러 Search Everywhere Dialog를 연다. Edit Cus..
안드로이드 Manifest intent-filter 동적으로 비활성화하기 앱을 런처로 만들어주는 intent-filter를 추가하였습니다. 특정 빌드버전에서는 이를 비활성화 하고 싶었습니다. 위의 intent-filter를 따로 빼서 activity-alias에 넣어줍니다. 다만, 위의 한줄도 같이 넣어주어야 런처 홈화면으로 작동하더라는.. 시작 Activity의 onCreate에서 다음과 같이 추가해주어 활성화/비활성화가 가능합니다. 비활성화 packageManager.setComponentEnabledSetting( ComponentName(packageName, "$packageName.AliasMainActivity"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP ) 활성화..
안드로이드 RxBle 사용하기, 예제 안드로이드에서의 ble 예제를 올렸었는데요. [Android/통신] - [안드로이드 Kotlin] BLE(Bluetooth Low Energy) 통신 예제 [Android/Architecutre] - [안드로이드 Service] MVVM구조에서 BluetoothLE Service 사용하기 이번 포스트에서는 Rx를 사용하는 편리한 RxBle 라이브러리를 소개합니다. RxAndroidBle Polidea/RxAndroidBle An Android Bluetooth Low Energy (BLE) Library with RxJava2 interface - Polidea/RxAndroidBle github.com 위의 라이브리러리를 사용해 반응형으로 Ble를 구현한것으로, RxJava에 생소하다면 어려울 수 있습..
안드로이드 네비게이션 바, 상태바 숨기기 전체화면 모드로 아래를 스와이프 하면 네비게이션 바가 보이는 모드입니다. 이전 버전이 deperacated 되었으므로 버전을 나누어 줍니다. /** * Hides the system bars and makes the Activity "fullscreen". If this should be the default * state it should be called from [Activity.onWindowFocusChanged] if hasFocus is true. * It is also recommended to take care of cutout areas. The default behavior is that the app shows * in the cutout area in portrait mode if..
[안드로이드] module(또는 library)에서 flavors 지정하는 법 클린 아키텍처 사용으로 presentation(app)은 data, domain 모듈을 의존하고 있습니다. 그런데 data 모듈에서만 flavor를 나누고 싶었는데, presentation이 의존하고 있으므로, 같이 변화가 필요했습니다. 다음과 같이 사용하면 됩니다. data module(gradle) android{ flavorDimensions "mode" productFlavors{ cardreader{ dimension "mode" manifestPlaceholders = [ thingsRequired: "true" ] buildConfigField "Boolean","IS_CARD", "true" } nocardreader{ dimension "mode" manifestPlaceholders =..
livedata의 "androidx.lifecycle.observe is deprecated" 해결 방안 Kotlin 1.4에서 deprecated되었습니다. 다음과 같이 사용하면 됩니다. viewModel.liveData.observe(viewLifecycleOwner, Observer { result -> }) /* viewModel.liveData.observe(viewLifecycleOwner) { result -> } */ import androidx.lifecycle.observe 를 삭제, import androidx.lifecycle.Observer를 추가합니다.

728x90
반응형