androidcallandroid-2.1-eclair

Automatically answer call in android 2.1


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.


Solution

  • // 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