1. 1
2017 Mid-term Examination (100)
Architecting Smart Devices
Date: 2017-10-19
1. 요즘 Voice UX (음성 사용자 경험)를 채택한 다양한 Smart Device가 출시되고 있다.
기술 개발이 진행 중인 Voice UX의 장단점을 논리적으로 쓰시오. (20)
- 장점: 특별한 사용법 학습 없이 대화를 통해 장치를 제어할 수 있음, 사용자 의도를
종합하여 가장 적절한 장치 반응을 생성할 수 있음, 장치를 개인 비서 형태로 사용할
수 있음
- 단점: 음성을 매개로 장치를 제어하기 때문에 소음이 크거나 여러 사람이 있는 경우
는 사용이 어려움, 음성을 넘어선 문맥 이해가 필요하지만 현재 기술력이 이를 따라가
지 못함
2. Android OS 기능을 이용해 아래 작업을 할 수 있는 Code를 작성하시오. Code는 짧
을수록 가산점 반영; Permission은 고려하지 말 것. (30)
1) SMS 기능을 직접 사용하여 “010-1234-5678” 전화번호로 “Hello, world.” 문자열 전
송
SmsManager.getDefault().sendTextMessage(“010-1234-5678”, null, “Hello, world.”, null,
null);
2) “010-1234-5678”로 직접 전화 걸기
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(“tel:010-1234-5678”)));
3) 연락처 정보를 선택할 수 있는 Activity 띄우기
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setData(ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
startActivityForResult(intent, 1234);
2. 2
3. BroadcastReceiver에 대해 다음을 답하시오. Code는 짧을수록 가산점 반영. (30)
1) BroadcastReceiver에서 IntentFilter를 사용하는 이유를 논리적으로 설명하시오. (10)
BroadcastReceiver는 다양한 종류의 Global Message를 수신할 수 있어, CPU와 Battery
사용에 불리한 점으로 작용할 수 있다. 이를 효과적으로 해결하려면 우리가 필요로 하
는 Intent만 선별적으로 수신해야 한다. 따라서 Intent Filtering 기능을
BroadcastReceiver에 적용하는 것이 효율적이다.
2) MyBroadcastReceiver가 이미 정의된 경우, “SMS_SENT” Action을 수신할 수 있는
BroadcastReceiver를 등록(Register)하는 Code를 작성하라. (20)
MyBroadcastReceiver myRx;
myRx = new MyBroadcastReceiver;
registerReceiver(myRx, new IntentFilter(“SMS_SENT”));
4. Button을 누르면 음성 인식하여 다음 기능을 실행하는 Code를 작성하라: “통화”란 명
령에는 sNumber로 직접 전화, “문자”란 명령에는 sNumber로 sText 문자를 직접 발송.
Button의 ClickListener는 이미 구성되어 있다고 가정하라. Code는 짧을수록 가산점 반영.
(20)
protected Button btRecog;
protected String sNumber = “010-1234-5678”, sText = “I am H.”;
protected void onCreate(Bundle savedInstanceState) {
…
btRecog = (Button) findViewById(R.id.btRecog);
btRecog.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.KOREAN);
startActivityForResult(intent, 1234);
3. 3
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1234 && resultCode == RESULT_OK && data != null) {
ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String sCom = result.get(0);
if (sCom == “통화”)
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(“tel:” + sNumber)));
else if (sCom == “문자”)
SmsManager.getDefault().sendTextMessage(sNumber, null, sText, null, null);
}
}