Using Google Contacts API, you can filter contacts using the following steps.
Add the Google Contacts Library to your project by adding the following line to your string.xml file.
<string name="google_contacts_api_key">YOUR_KEY_HERE</string>
Note: Replace YOUR_KEY_HERE with your Google Contacts API Key.
Create a class which will be used to store the user’s contacts.
Make use of the ContactsService class to access the contacts data from the Google Contacts Database.
Use ContactsQuery Builder class to specify the filter criteria. This filter criteria will allow you to easily search for contacts.
Use the ContactEntry.getText() method to retrieve the required contact data.
Finally, you can use the contacts data that you retrieved using the ContactEntry.getText() method to filter your contacts.
For more information on how to use the Google Contacts API to filter contacts, please see the official documentation here: https://developers.google.com/contacts/v3/?hl=en.
I hope this information helps!