A new feature introduced in Android Nougat (API 24) is the ability to handle blocking phone numbers at the OS level. This provides a consistent experience for the user across multiple devices with the following:
- Blocked Numbers block both incoming calls and text messages
- Blocked Numbers can be backed up using the Backup & Restore feature
- All apps on the device share the same Blocked Numbers list
In this recipe, we will look at the code to add a number to block, remove the number, and how to check whether the number is already blocked.