Programing/Android / Java
Android/JAVA - End Call (내 어플에서 통화 종료 하기)
빅터크룸
2014. 4. 7. 20:18
간혹 내가 만든 어플에서 통화 종료를 제어하고 싶은 경우가 있습니다.
이럴때는 ITelephony를 추가 후 Telephony Service를 사용하는 방법이 있습니다.
Telephony Framework의 API를 바로 호출해서 사용하는 방식입니다.
import com.android.internal.telephony.ITelephony;
try{
tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
Class<?> c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephonyService = (ITelephony) m.invoke(tm);
telephonyService.endcall();
}
catch(Exception e)
{
e.printStackTrace();
}