Skip to content
Tony Myles edited this page Jul 13, 2017 · 3 revisions

#AferoJavaSDK Overview

AferoClientRetrofit2 Setup

    AferoClientRetrofit2.Config aferoClientConfig = new AferoClientRetrofit2.ConfigBuilder()
        .clientId(myOAuthClientId)
        .clientSecret(myOAuthClientSecret)
        .logLevel(BuildConfig.HTTP_LOG_LEVEL)
        .defaultTimeout(DEFAULT_SERVICE_TIMEOUT)
        .imageScale(AferoClient.ImageScale.fromDisplayDensity(screenDensity))
        .build();

    mAferoClient = new AferoClientRetrofit2(aferoClientConfig);

    mAferoClient.setOwnerAndActiveAccountId(accountId);

    if (token != null) {
        mAferoClient.setToken(new AccessToken(accessToken, refreshToken));
    }

DeviceCollection Setup

    mDeviceCollection = new DeviceCollection(mAferoClient, ClientID.get(this));
    mDeviceCollection.start();

DeviceCollection Setup

public Observable addDevice(String associationId, boolean isOwnershipVerified)

    deviceCollection.addDevice(associationId, false)
        .subscribe(new Action1<DeviceModel>() {
            @Override
            public void call(DeviceModel deviceModel) {
                // do stuff...
            }
        });

public Observable removeDevice(DeviceModel deviceModel)


Softhub Setup

    mAferoSofthub = AferoSofthub.acquireInstance(this, mAferoClient, ClientID.get(this));
    mAferoSofthub.setService(BuildConfig.AFERO_SOFTHUB_SERVICE);

DeviceWifiSetup

    DeviceWifiSetup(DeviceModel deviceModel, AferoClient aferoClient)
Clone this wiki locally