I want to create an app that blocks all numbers that are not in contacts. I have read this but it is not perfect. How to do this? Thanks for reading
Asked
Active
Viewed 2,313 times
2
-
1What you have tried to code yet? – Pankaj Dec 09 '15 at 09:54
-
i try this: telephonyService = (ITelephony) m.invoke(tm); telephonyService.silenceRinger(); telephonyService.endCall(); – Android Wind Dec 09 '15 at 10:09
-
but i don't know how to block unknown number – Android Wind Dec 09 '15 at 10:10
1 Answers
1
This is one way to use it. First, you have to use ITelephony in your project. I will give you an example to use it in below link. Second, you have to insert code to start service when you restart phone as follows:
in AndroidManifest File :
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Change this to :
@Override
public void onReceive(Context context, Intent intent) {
Intent serviceIntent = new Intent(context,BackgroundService.class);
startService(serviceIntent);
}
The sample code at https://github.com/Levon-Petrosyan/Call_redirect_and_reject

Jame
- 3,746
- 6
- 52
- 101