Auto Answer Incoming call Android programmatically
<p>I am using this code:</p>

<pre><code>        try {
            TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            Class&lt;?&gt; c = Class.forName(tm.getClass().getName());
            Method m = c.getDeclaredMethod("getITelephony");
            m.setAccessible(true);
            com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
            telephonyService = (ITelephony) m.invoke(tm);

            // telephonyService.silenceRinger();
            telephonyService.answerRingingCall();
        } catch (Exception e) {
            e.printStackTrace();
        }
</code></pre>

<p>This code needs Modify_Phone_State permission which is depreciated.
Any alternative way to auto answer the incoming calls?</p>