본문 바로가기

OS

(73)
안드로이드 블루투스 연결 및 해제 브로드캐스트 리시버 음악 관련된 앱들은 블루투스를 연결했을 때와 해제했을 때 소리가 중지되는 것이 일반적이다. 이러한 기능을 개발할 수 있도록 안드로이드에서는 브로드캐스트 리시버에 블루투스 연결 액션이 존재한다. BluetoothDevice.ACTION_ACL_CONNECTED 블루투스에 기기가 연결되었을 때 BluetoothDevice.ACTION_ACL_DISCONNECTED 블루투스에 기기가 해제되었을 때 이외에도 블루투스 관련 액션이 많으므로 필요한 액션이 필요하다면 공식문서에서 찾아보면 된다. https://developer.android.com/reference/android/bluetooth/BluetoothDevice class BlueToothConnectReceiver : BroadcastReceiver(..
안드로이드 헤드셋 연결 브로드캐스트 리시버 음악 관련 앱들을 보면 이어폰을 뽑았을 때 음악이 중지되는 것이 일반적임. class HeadSetConnectReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { if(intent?.action == (Intent.ACTION_HEADSET_PLUG)) { var headsetState = intent.getIntExtra("state", -1) var headsetName = intent.getStringExtra("name") println("YK $headsetState") println("YK $headsetName") when(headsetState) { 0 -> { instanc..
Asset 폴더에 있는 ogg 파일을 패키지 디렉토리로 복사하기 private void copyToFile(Context context) { AssetManager am = context.getAssets(); String[] fileList = null; try { fileList = am.list("Temp"); for(int i = 0; i
Android Assets DB 파일 패키지 data 폴더로 이동하기 Asset 폴더에 DB 파일을 고유 data 폴더로 이동시키는 로직이 필요하여 만들어보았다. //Asset 폴더 경로가 asset/db/abc.db일때 private static final String ASSETS_FILE_DB = "db/abc.db"; public void copyDbFile(Context context) //assets/db 파일을 가지고와서 패키지 파일에 복사하는 작업 { AssetManager am = context.getAssets(); try { InputStream is = am.open(Const.ASSETS_FILE_DB); BufferedInputStream bis = new BufferedInputStream(is); String strDbPath = context...
Android AudioFocus //http://202psj.tistory.com 사운드 포커스로 설정을 해도 사운드가 들리지 않는다면 해당 기기가 wav, mp3 등 코덱을 지원하는지 확인해보자. 출처: http://shadowxx.egloos.com/10987471 오늘은 안드로이드에서 사용하고 있는 Audio Focus 라는 놈에 대해서 이야기할까 합니다. 사실 처음에 구글 문서만 읽고서 도대체 이 Audio Focus 의 처리의 주체가 누구일까 하고 조금 헷갈렸던 부분이 있었는데요. 그래서 오늘 바로 이 놈에 대해서 이야기를 하려합니다. Application programming 을 하시는 분들이라면, 저처럼 헷갈려하지는 않을텐데요. 그럼 시작하겠습니다. 현재 Android Jellybean 에서는 Audio Focus 의 종류..
Android Studio Debugger 안드로이드 공식 홈페이지입니다. Android Studio에 대한 정보가 많으니 즐겨찾기 해놓고 주기적으로 방문하도록 합시다! 중단점을 우클릭하면 중단점에 다양한 옵션을 부여할 수 있습니다. 먼저 제일 위에 있는 체크를 해제하면 중단점을 무효화할 수 있습니다. (사라지는 건 아닙니다.) 무효화가 된 중단점에서는 앱이 멈추지 않습니다. 바로 밑의 Suspend는 중단점이 적중했을 때 앱 전체를 멈출 것인지(All), 아니면 코드가 속한 스레드만 멈출 것인지(Thread) 설정합니다. 왼쪽의 Suspend에 체크를 아예 해제해버리면 중단점이 적중했을 때 앱이 멈추지 않습니다! Thread를 선택하면 오른쪽의 Make Default 버튼이 활성화되는데, 누르면 다음부터 중단점을 만들 때마다..
mysql or mariadb 원격접속 1. mysql 원격 아이디 생성 msyql -> grant all privileges on *.* to 'yk'@'%'; mysql -> flush privileges; vim /etc/my.cnf bind-address = 127.0.0.1 -> 0.0.0.0 수정 netstat -ntlp | grep mysqld firewall 사용하고 있으면 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload firewall-cmd --list-ports iptables -I INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
안드로이드 View와 ViewGroup ● 뷰(View)란 무엇인가? - 공식문서에서의 View This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.). TheViewGroup subclass is the base class for layouts, which are invisibl..