question

Bryanne Vega avatar image
Bryanne Vega asked Raymond Lee Deactivated answered

Can the SDK find a customer by Phone Number?

I've tried searching but so far, with the SDK (not the API) I haven't been able to find a customer with the phone number as a search query only.

May someone shed some light?




OrdersCustomers
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Raymond Lee avatar image
Raymond Lee Deactivated answered
Hi @Bryanne Vega,

You can use the CustomerConnector getCustomers(String query) method to query for customers by phone number. You can query against first name, last name, and phone number; your query can be a partial name/number, and it will return a list of customer objects matching your query.

Here is the JavaDoc on the method: https://clover.github.io/clover-android-sdk/com/cl...

Here is an example of how to use it:
try {
    CustomerConnector customerConnector = new CustomerConnector(getApplicationContext(), mAccount, null);

    List<Customer> customerList = customerConnector.getCustomers("5558881234");

    for (Customer customer : customerList) {
        Log.d("CUSTOMER", customer.getFirstName());
    }
}

catch (ClientException | ServiceException | BindingException | RemoteException e) {
    e.printStackTrace();
}

Hope that helps,

Raymond
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community