0

In my android project(with target sdk version 23), I want reject incoming call. I know that there are a lot of question about this, in particular

1 How to import com.android.internal.telephony.ITelephony to the Android application

2 How to Reject a call programatically in android

3 How to reject any incoming call when I have already detected it

In the first one link, the suggest solution is use reflection on the interface ITelephony because it's an internal interface. But this solution use MODIFY_PHONE_STATE permission, which can only be granted to system apps so it won't work anyway.

From second and third link, I understand that solution is copy ITelephony from here then put it in a new package of com.android.internal.telephony in my solution. The problem is that in this interface there are a lot of problem about find of class android.telephony.RadioAccessFamily (error cannot find symbol class RadioAccessFamily), that class is in platform framework base of android.

Any idea for resolve this problem?

Community
  • 1
  • 1
pask23
  • 714
  • 11
  • 20
  • Could you post your relevant code, I don;t see the need for RadioAccessFamily. Also try the tutorial at http://www.emoticode.net/android-sdk/block-incoming-and-outgoing-phone-calls-programmatically.html – g90 Dec 11 '15 at 15:27
  • the code is the interface ITelephony not my android code. The tutorial is old, 2 years ago, I use like target sdk version 23 – pask23 Dec 11 '15 at 15:32

1 Answers1

0

I found the answer myself. For others interested, here here it is:

create aidl folder in main folder.

create package com.android.internal.telephony in aidl folder

create a aidl file in package:

interface ITelephony {      

    boolean endCall(); 
    void answerRingingCall();      

}

for the code about end call see the answer in the link.

and it's not necessary add the permission

android.permission.MODIFY_PHONE_STATE

Community
  • 1
  • 1
pask23
  • 714
  • 11
  • 20