Reputation: 311
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.
Upvotes: 2
Views: 446
Reputation: 618
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
Upvotes: 0