简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM