I am developing a call blocking application. All features are working well. But in case of call blocking, call has been rejected with a small ring on dialer side. I am using service for call blocking. My question is how can I increase priority of this service in such a way that call is rejected prior any ring on dialer side. I have also used priority="999" in receiver's intent-filter in the manifest. But it doesn't solve my problem.
Asked
Active
Viewed 735 times
1 Answers
1
You can combine between a BroadcastReceiver with Service. Once a call is coming, Android system triggers BroadcastReceiver to fire onReceive() method. Inside this method, call context.startService(). So you don't need to set the priority to your Service.
You can read this post about handling an incoming call automatically.
Community
- 1
- 1
Anggrayudi H
- 14,977
- 11
- 54
- 87
-
Same problem occurs sometime. This is not the perfect solution. – Shahbaz Hashmi May 03 '15 at 20:47
-
I have to block the number without ring on dialer side. Your solution is working well but sometimes it doesn't work. approx in every 2 out of 10 attempt. How can I get the broadcast before ring ? – Shahbaz Hashmi May 04 '15 at 10:31
-
BroadcastReceiver always getting called by system once a event is happening on your device. So that, you can't trigger it before ring. My explanation are refers to the lifecycle of BroadcastReceiver class. Please search on Google about it. – Anggrayudi H May 04 '15 at 10:45
-
OK. Can I access phonestatelistener before ring ? – Shahbaz Hashmi May 04 '15 at 10:50
-
I don't know, I never test that. You can make your own experiment for that. – Anggrayudi H May 04 '15 at 10:54
-
Thanks @ Anggrayudi H – Shahbaz Hashmi May 04 '15 at 10:56