private void removeFromSystemBlockList(String phoneNumber) { // For Android 7+ (API 24+) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { try { ContentResolver contentResolver = context.getContentResolver(); Uri uri = BlockedNumbersContract.BlockedNumbers.CONTENT_URI; String selection = BlockedNumbersContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER + "=?"; String[] selectionArgs = new String[]{phoneNumber}; contentResolver.delete(uri, selection, selectionArgs); } catch (SecurityException e) { e.printStackTrace(); } } }
public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } unblock a number on android