How to: Block Unwanted Calls
This page will guide you though configuring blocking options within the Android Client SDK.
This guide assumes you have completed the previous guide to enable caller id. Blocking functionality relies on the same permissions.
Enable blocking
In order to call blocking to work effectively you will need to call HiyaService.startCallScreening(Context). If you want to disable call blocking you can call HiyaService.stopCallScreening(Context)
Block Categories of Unwanted Calls
Hiya can block calls based on a variety of categories, use these functions to control which types of calls the Hiya SDK will block. By default no categories of calls are blocked.
Block Suspect Spam Calls
Set whether or not to block incoming spam calls by calling HiyaService.blockIncomingSpamCall(Context, Boolean)
// Start blocking incoming spam calls
HiyaService.blockIncomingSpamCall(context, true)
Check if the SDK is currently blocking spam calls by calling HiyaService.getBlockIncomingSpamCall(Context)
// Check if currently blocking incoming spam calls
val currentlyBlockingSpamCalls = HiyaService.getBlockIncomingSpamCall(context)
Blocking calls requires the Android call screener role (ROLE_CALL_SCREENING)
Block Calls From Known Fraud callers
Set whether or not to block incoming fraud calls by calling HiyaService.blockIncomingFraudCall(Context, Boolean)
// Start blocking incoming fraud calls
HiyaService.blockIncomingFraudCall(context, true)
Check if the SDK is currently blocking fraud calls by calling HiyaService.getBlockIncomingFraudCall(Context)
// Start blocking incoming fraud calls
val currentlyBlockingFraudCalls = HiyaService.getBlockIncomingFraudCall(context)
Blocking calls requires the Android call screener role (ROLE_CALL_SCREENING) HiyaService.blockIncomingFraudCall(Context, boolean)
Block Calls From Private Numbers
Set whether or not to block incoming private calls by calling HiyaService.blockIncomingPrivateCall(Context, Boolean)
// Start blocking incoming private calls
HiyaService.blockIncomingPrivateCall(context, true)
Check if the SDK is currently blocking fraud calls by calling HiyaService.getBlockIncomingPrivateCall(Context)
// Start blocking incoming private calls
val currentlyBlockingFraudCalls = HiyaService.getBlockIncomingPrivateCall(context)
Blocking calls requires the Android call screener role (ROLE_CALL_SCREENING)
Configure a User Managed Block list
To manage the user defined block list you will need to acquire an instance of HiyaRepo by calling HiyaService.getHiyaRepo(Context)
Use these functions to allow users to manage their block list: