Automatically answer call in android 2.1

十年热恋 提交于 2019-12-25 05:14:16

问题


I am looking for some code to automatically answer incoming call in android 2.1. I have looked on some of the available threads on stack-overflow but they do not seem to work for Android 2.1.

Can anybody give some peace of code to help me. Thanks in advance.


回答1:


// Set up communication with the telephony service (thanks to Tedd's Droid Tools!)

TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephonyService;
telephonyService = (ITelephony)m.invoke(tm);
// Silence the ringer and answer the call!
telephonyService.silenceRinger();
telephonyService.answerRingingCall();

Refer this LINK1 LINK2



来源:https://stackoverflow.com/questions/10058687/automatically-answer-call-in-android-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!