问题
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