Platform Docs

Integrating with Clover Android SDK

Integration with Clover Android SDK

Use the Clover Android SDK and related Java documentation to access merchant data. For this example, we will display information on one inventory item.


For this tutorial, you must have one item in your merchant's inventory. You can do this through the Inventory app.

  1. Add a dependency for the most recent version of the Clover Android SDK to the file for your app's module. Replace the versionNum value with the number of the latest version.
dependencies {
  implementation 'com.clover.sdk:clover-android-sdk:versionNum'

Your file should resemble the file in the following image. Note the Clover Android SDK dependency declaration on line 25.

  1. Add <uses-permission android:name="android.permission.GET_ACCOUNTS"/> to the AndroidManifest (this is required to connect with the merchant account).
  1. Add an ID to the textView element to enable dynamic text insertion.
  1. Finally, you can replace your Activity with this code to pull out the merchant data:

import android.accounts.Account;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.os.Bundle;
import android.widget.TextView;

import com.clover.sdk.util.CloverAccount;
import com.clover.sdk.v1.BindingException;
import com.clover.sdk.v1.ClientException;
import com.clover.sdk.v1.ServiceException;
import com.clover.sdk.v3.inventory.InventoryConnector;
import com.clover.sdk.v3.inventory.Item;

public class MainActivity extends AppCompatActivity {

    private Account mAccount;
    private InventoryConnector mInventoryConnector;
    private TextView mTextView;

    protected void onCreate(Bundle savedInstanceState) {

    protected void onResume() {

        mTextView = (TextView) findViewById(;

        // Retrieve the Clover account
        if (mAccount == null) {
            mAccount = CloverAccount.getAccount(this);

            if (mAccount == null) {

        // Connect InventoryConnector

        // Get Item
        new InventoryAsyncTask().execute();

    protected void onDestroy() {

    private void connect() {
        if (mAccount != null) {
            mInventoryConnector = new InventoryConnector(this, mAccount, null);

    private void disconnect() {
        if (mInventoryConnector != null) {
            mInventoryConnector = null;

    private class InventoryAsyncTask extends AsyncTask<Void, Void, Item> {

        protected final Item doInBackground(Void... params) {
            try {
                //Get inventory item
                return mInventoryConnector.getItems().get(0);

            } catch (RemoteException | ClientException | ServiceException | BindingException e) {
            return null;

        protected final void onPostExecute(Item item) {
            if (item != null) {

Now you can sideload your app onto your device to see it in action.

Updated 6 months ago

Integrating with Clover Android SDK

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.