2

I wrote an application which has the capability of hanging up phone calls when they are received. In order to that I'm using the telephony manager and this permission is required: android.permission.MODIFY_PHONE_STATE

However, this permission makes my app a system app and therefore I won't be able to place it in the play store later. But I've seen apps in the play store that successfully block incoming calls ("Calls Blacklist" for example). I wonder, does anyone know what API these apps are using in order to block an incoming call and also allow these apps in the play store ?

Thanks.

user2630165
  • 311
  • 3
  • 10

1 Answers1

0

You need to make use of Broadcastreceiver class. and also need to add this line in manifest to get persmission.

<uses-permission android:name="android.permission.READ_PHONE_STATE">

follow this.

Make sure TelephonyManager.CALL_STATE_RINGING is only incoming call. You cannot detect outgoing call state whether it is ringing or answered. for outgoing there only two states:

TelephonyManager.CALL_STATE_IDLE
&
TelephonyManager.CALL_STATE_OFFHOOK
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
dawncode
  • 578
  • 1
  • 8
  • 22
  • What about blocking the call? My problem is hanging up the call, and I want my app to not be a system app. – user2630165 Oct 29 '15 at 07:18
  • create the service which in the background and in your CALL_STATE_RINGING write this code. ref: http://stackoverflow.com/questions/18065144/end-call-in-android-programmatically – dawncode Oct 29 '15 at 09:17