2

I am developing an app(for Froyo and upwards) in which one of the functionalities is to auto answer a call as soon as it is received. I've searched a lot on this topic - some say it is not allowed, some have found a workaround to it. They're using com.android.internal.telephony.ITelephony which Eclipse says does not exist(..sort of, I get that bulb and red cross). Can you suggest something? If you know any links/code for this please, please post it here!

Thanks!

Saturnian
  • 1,686
  • 6
  • 39
  • 65

2 Answers2

0

You should create a package com.android.internal.telephony in your project, place ITelephony.java there. In that interface fin=le you should declare methods of ITelephony you want to use in your project. All that is done so that java compiler doesn't complain about missing files.

After that, use Reflection API to get actual ITelephony implementation in run time. Here's more info on the subject: How do I add ITelephony.aidl to eclipse?

Community
  • 1
  • 1
  • This is my code(after adding ITelephony.java), it won't work, its in a Broadcast Receiver: `Log.v(TAG, "Receving...."); TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try { Class c = Class.forName(telephony.getClass().getName()); Method m = c.getDeclaredMethod("getITelephony"); m.setAccessible(true); telephonyService = (ITelephony) m.invoke(telephony); //telephonyService.silenceRinger(); telephonyService.answerRingingCall(); } catch (Exception e) { e.printStackTrace(); }` – Saturnian Mar 06 '13 at 17:34
0

In android 2.3 and above version it is not possible.