안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요
전화 통화 관련 어플을 만들고 있는데 가능한지 먼저 여쭤봅니다.
첫번째.
최근통화 목록이나 기본 다이얼 화면에서 전화 연결을 하려고 할때 통신사를 통해서 연결하지 않고 다른 교환기로 통해서 걸도록 하려고 합니다.
무료 국제전화 어플같은거 보면 다이얼 화면에서 번호 누르고 통화버튼 눌러도 자체 어플을 통해서 연결되던데
어떻게 가능한건지 궁금합니다.
두번째.
휴대폰 자체 하단 메뉴에 통화 버튼을 누르면 기본 다이얼을 띄울지 자체 어플을 띄울지 묻는 메뉴를 만들고자 하는데
가능할까요?
아시는분 계시면 답변 부탁드리고 미리 감사드립니다.
액티비티 등록하실 때 Intent Filter를 사용하시면 될 것 같습니다.
Dialer는 다음처럼 하시면 전화다이얼 화면을 나올 때 선택화면이 나올 겁니다. 인텐트를 검색해 보시면 어떻게 동작하는지 아실 수 있을 겁니다.
<activity android:name="Your activity name"
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
</activity>
그리고 이건 안드로이드에 기본 들어가 있는 PhoneApp의 AndroidManifest.xml 에 나오는 설정입니다.
<activity-alias android:name="PrivilegedOutgoingCallBroadcaster"
android:targetActivity="OutgoingCallBroadcaster"
android:permission="android.permission.CALL_PRIVILEGED">
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter android:icon="@drawable/ic_launcher_sip_call">
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sip" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="voicemail" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/phone_v2" />
<data android:mimeType="vnd.android.cursor.item/person" />
</intent-filter>
</activity-alias>
커맨드 창이나 터미널에서
adb -e shell am start -a android.intent.action.CALL -d tel:12345
adb -e shell am start -a android.intent.action.CALL_PRIVILEGED -d tel:12345
를 실행해 보시면 위의 설정들이 어떻게 되는지 확인하실 수 있을 겁니다.