Samsung

Retired DISLab
Swpark (토론 | 기여) 사용자의 2017년 6월 19일 (월) 07:49 버전
(비교) ← 이전 판 | 현재 판 (비교) | 다음 판 → (비교)
이동: 둘러보기, 찾기

목차

첨기연 설정

Key 인증

  1. 삼성에서 발급한 키값으로 인증을 해야한다.
C:\>keytool -storepass changeit -import -file "d:\samsung.crt" -keystore
"C:\Program Files\Java\jdk1.8.0_101\jre\lib\security\cacerts" -alias samsungcert


C:\>cd C:\Program Files (x86)\Java\jdk1.7.0_17\bin
 
C:\Program Files (x86)\Java\jdk1.7.0_17\bin>keytool -storepass changeit -import
-file "c:\samsung_university.cer" -keystore "C:\Program Files (x86)\Java\jdk1.7.
0_17\jre\lib\security\cacerts" -alias samsungcert
소유자: EMAILADDRESS=hyoungjeen.yoon@samsung.com, CN=SAMSUNG University, OU=SAMS
UNG University, O=SAMSUNG Electronics, L=Yongin, ST=Gyeonggi-do, C=KR
발행자: EMAILADDRESS=hyoungjeen.yoon@samsung.com, CN=SAMSUNG University, OU=SAMS
UNG University, O=SAMSUNG Electronics, L=Yongin, ST=Gyeonggi-do, C=KR
일련 번호: 88f6cbee49905a00
적합한 시작 날짜: Sat Dec 28 09:51:55 KST 2013, 종료 날짜: Tue Dec 26 09:51:55 K
ST 2023
인증서 지문:
         MD5: B8:94:C2:00:74:FF:76:0E:D9:28:CA:D0:EA:88:38:17
         SHA1: 1A:F6:1D:E8:22:22:88:FB:6E:3F:2E:6F:55:96:05:39:6F:93:EB:AC
         SHA256: 75:A0:FE:29:22:C5:FA:AA:29:7C:AC:55:A8:1E:EF:F7:8D:98:D0:20:B9:
73:A4:CA:D4:03:6F:04:BE:B6:4F:85
         서명 알고리즘 이름: SHA1withRSA
         버전: 3
 
확장:
 
#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 44 6E ED 97 11 6A 2C A4   07 4D 86 CF C2 8C 59 89  Dn...j,..M....Y.
0010: 92 34 11 50                                        .4.P
]
[EMAILADDRESS=hyoungjeen.yoon@samsung.com, CN=SAMSUNG University, OU=SAMSUNG Uni
versity, O=SAMSUNG Electronics, L=Yongin, ST=Gyeonggi-do, C=KR]
SerialNumber: [    88f6cbee 49905a00]
]
 
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
  CA:true
  PathLen:2147483647
]
 
#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 44 6E ED 97 11 6A 2C A4   07 4D 86 CF C2 8C 59 89  Dn...j,..M....Y.
0010: 92 34 11 50                                        .4.P
]
]
 
이 인증서를 신뢰합니까? [아니오]:  y
인증서가 키 저장소에 추가되었습니다.
 
C:\Program Files (x86)\Java\jdk1.7.0_17\bin>

Android Studio 설정

  1. Proxy 설정
    • Menu : File/Settings/Appearance & Behavior/System Settings/HTTP Proxy
    • 값: 10.241.3.7:8080
  2. JDK 경로 설정 변경
    • Menu : File/Project Structure/SDK Location/JDK location
    • uncheck : Use embedded JDK (recommended)
    • 경로설정 : C:\Program Files\Java\jdk1.8.0_101
  3. SDK Manager 설정
    • Menu : Tools/Android/SDK Manager/Launch Standalone SDK Manager/Tools/Options
    • check : Force https:// ... soources to be fetched using http:// ...
  4. SDK Dowonload

build.gradle 설정

  • proxy 설정 때문에 컴파일이 제대로 되지 않는다. 아래와 같이 project의 build.gradle을 수정한다.
buildscript {
    repositories {
        jcenter({url "http://jcenter.bintray.com/"})
    }
    dependencies {
        classpath "com.android.tools.build:gradle:2.3.3"
 
    }
}
 
allprojects {
    repositories {
        jcenter({url "http://jcenter.bintray.com/"})
    }
}
 
task clean(type: Delete) {
    delete rootProject.buildDir
}
  • 이것은 Android Studio를 띄울때 마다 새로 설정해야 합니다.
  • 새로 설정하지 않는 방법은 다음과 같습니다.
    1. C:\Users\SEC\.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9\gradle-3.3\bin 폴더 있는 gradle.bat 파일을 더블클릭해서 실행한다.
    2. C:\Users\SEC\.gradle 폴더에 init.gradle 파일(아래 내용과 같음)을 복사해 넣는다.
allprojects {
    buildscript.repositories {
        jcenter({ url "http://jcenter.bintray.com" })
        maven { url "http://10.252.250.53:8081/lm/content/groups/public/" }
    }
    buildscript.configurations.all {
        resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    }
    repositories {
        jcenter({ url "http://jcenter.bintray.com" })
        maven { url "http://10.252.250.53:8081/lm/content/groups/public/" }
    }
    configurations.all {
        resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    }
}

Android Application Project 설정

  1. gradle.properties에 다음 항목 추가. 실습 PC의 메모리가 적어 힙크기를 줄여야 함.
org.gradle.jvmargs=-Xmx512m
 
systemProp.https.proxyPort=8080
systemProp.https.proxyHost=168.219.61.252
systemProp.http.proxyPort=8080
systemProp.http.proxyHost=168.219.61.252

실습자료

소스 코드 교안 다운로드

아래 코드를 다운로드 받아서 코드를 복사하여 실습합니다. 만약 파일이 zip 형태로 받아진다면, 다운로드 후 확장자를 pptx로 변환하면 됩니다.

한글 입력기 설치 방법

  1. HangulKeyboard.zip을 다운로드 받아 압축해제한다.
  2. 에뮬레이터에 설치한다.
C:> adb install HangulKeyboard.apk

예제 프로그램 다운로드

Android 개념 및 개발 환경

II-2. 개발 환경 구축과 샘플 프로그램

II-4. Android 개발 도구

  • Ex-Notepad) TraceView - 도구 사용법을 익히기 위하여 설치하는 프로그램. 실행하면 데이터베이스가 만들어진다.

II-5. Activity

II-6. User Interface - Layout & Menu

II-7. Activity

User Interface, Intent와 Broadcast Receiver

III-1. User Interface - Dialog

III-2. View

III-3. User Interface - Resource

III-5. Intent & Adapter 연습

III-8. Service - IPC

데이터 저장, Telephony, Notification & Graphics

IV-1. Preference & File

IV-2. Database

IV-4. Network & Web

        protected Void doInBackground(Void... params) {
            Log.e("Earthquake", "doInBackground() is called.\n");
            // Get the XML
            URL url;
            try {
                TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
                    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                        return null;
                    }
 
                    public void checkClientTrusted(X509Certificate[] certs, String authType) {
                    }
 
                    public void checkServerTrusted(X509Certificate[] certs, String authType) {
                    }
                } };
 
                SSLContext sc = SSLContext.getInstance("SSL");
                sc.init(null, trustAllCerts, new java.security.SecureRandom());
                HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
 
                // proxy가 설정되어 있는 경우
                //Properties systemProperties = System.getProperties();
                //systemProperties.setProperty("http.proxyHost", "10.241.3.7");
                //systemProperties.setProperty("http.proxyPort", "8080");
 
                String quakeFeed = getString(R.string.quake_feed);
                url = new URL(quakeFeed);
                Log.e("Earthquake", "doInBackground() is called.2\n");
 
                URLConnection connection = url.openConnection();
                HttpURLConnection httpConnection = (HttpURLConnection)connection;
 
                Log.e("Earthquake", "doInBackground() is called.3\n");
 
                int responseCode = httpConnection.getResponseCode();
 
                if (responseCode == HttpURLConnection.HTTP_OK) {
                    Log.e("Earthquake", "Succeeded http request..($1)\n");
 
                    InputStream in = httpConnection.getInputStream();
 
                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                    DocumentBuilder db = dbf.newDocumentBuilder();
 
                    // 지진 피드를 파싱한다.
                    Document dom = db.parse(in);
                    Element docEle = dom.getDocumentElement();
 
                    // 지난 지진 정보는 지운다
                    earthquakes.clear();
 
                    // 각각의 지진 입력 리스트를 가져온다.
                    NodeList nl = docEle.getElementsByTagName("event");
                    if (nl != null && nl.getLength() > 0) {
                        for (int i = 0 ; i < nl.getLength(); i++) {
                            Element entry = (Element)nl.item(i);
 
                            String details   = getValue(entry, "description", "text");
                            String latitude  = getValue(entry, "latitude");
                            String longitude = getValue(entry, "longitude");
                            String mag       = getValue(entry, "mag");
                            String when      = getValue(entry, "time");
 
                            if (details == null || latitude == null || longitude == null
                                    || mag == null || when == null)
                                continue;
 
                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSS'Z'");
                            Date qdate = new GregorianCalendar(0,0,0).getTime();
                            try {
                                qdate = sdf.parse(when);
                            } catch (java.text.ParseException e) {
                                e.printStackTrace();
                            }
                            Location l = new Location("dummyGPS");
                            l.setLatitude(Double.parseDouble(latitude));
                            l.setLongitude(Double.parseDouble(longitude));
 
                            double magnitude = Double.parseDouble(mag);
 
                            Quake quake = new Quake(qdate, details, l, magnitude);
                            Log.e("Earthquake", quake.toString() + "\n");
 
                            publishProgress(quake);
                        }
                    }
                }
                else {
                    String msg = String.format("$1", responseCode);
                    Log.e("Earthquake", String.format("Failed http request..($1)\n", msg));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

IV-5. Telephony, Notification & Alarm

IV-6. Graphics

IV-7. Media Framework

IV-8. Sensors

위치기반 서비스 & Field Application

V-1. Map

V-2. 위치기반서비스 - GPS

V-4. Preference

컴파일할 때 아래의 오류가 날 경우

The number of method references as a .dex file cannot exceed 64K.

build.gradle 파일을 아래와 같이 수정합니다.

android {
    ...
 
    defaultConfig {
        ...
        ...
 
        // Enabling multidex support.
        multiDexEnabled true
    }
 
    dependencies {
        ...
 
        compile 'com.android.support:multidex:1.0.0'
}

그리고 Manifest 파일을 다음과 같이 수정합니다.

    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

V-5. Content Provider를 통한 지진 데이터 공유

V-6. Map & Service

V-7. Background Thread & Notification

개인 도구
이름공간
변수
행위
둘러보기
구성원
연구
연구실
기타
도구모음
인쇄/내보내기