I'm creating a call blocking app. Had no idea about it so googled it and followed this link answer . Its working as a blocker but have a problem. Incoming call always received by default phone app so happens a little ringing and then ends the call. How to stop this ringing ? I mean it must be blocked before any kind of partial ringing. So need help and suggestion to block call before anything.
Asked
Active
Viewed 1,560 times
0
-
Even TrueCaller has this problem – Praveena Nov 09 '14 at 06:24
1 Answers
0
Just silence the ringer and you won't get any partial ringing. Here's the code to silence the ringer:
AudioManager mAudio = (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);
//Silence the ringer
mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
This will silence the ringer on the phone you are running call blocking app but you will still hear partial ringing from the phone you are calling because for blocking calls, you first need to receive call. Your app will first detect call and then only it can block calls.

gegobyte
- 4,945
- 10
- 46
- 76
-
@demo_Ashif Are you able to hear ringing sound after adding this code? – gegobyte Nov 09 '14 at 07:05
-
2@Chimay Sound is silent but ringing is happening , who is calling from other end he will first hear fraction of ringing and then call will stops. Thts the problem. – demo_Ashif Nov 09 '14 at 07:11
-
@demo_Ashif That's what I told, the person calling will definitely hear a fraction of sound because call blocking cannot be done without receiving a call. Just think of a basic call, if the other person hears ringing that means you are getting a call. If he doesn't hear anything then the call hasn't yet reached you, so blocking is impossible. So when the other person hears ringing sound, it means the call has reached you and your app has detected and blocked it. Think about this and you will find that it is quite logical that the other person will hear a fraction of ringing sound. – gegobyte Nov 09 '14 at 07:17