Search code examples
javaandroidtelephonymanager

create background android service to decline incoming phone calls


looking for resources on how to create an ongoing background service started by an android app which declines/silences and logs incoming phone calls. This must not use deprecated APIs/permissions for Android 10.


Solution

  • A way to decline an incoming call is to hang up the call but permissions are needed. Try to follow this (this is the concept) :

    1. Request Run time permissions(READ_PHONE_STATE, CALL_PHONE)

    2. Create a broadcast receiver that waits for incoming calls

    3. When incoming call is detected hang it up.

    Rely on this resource(here you have detailed instructions) : https://dev.to/nikola/how-to-make-a-native-android-app-that-can-block-phone-calls--4e15