2

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

Community
  • 1
  • 1

1 Answers1

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