question

niranjan avatar image
niranjan asked niranjan commented

how to get authToken and baseUrl value ?

When I run the example app(cloverinventoryexample) from clover android example which is available in github side, I am getting null value for both authToken and baseUrl? how to get their values? Can anyone help me on this ? Thanks in Advance?

10 |2000

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

Jacob Abrams avatar image
Jacob Abrams answered niranjan commented

On what device are you running the examples? The clover-android-sdk and the examples only function correctly on Clover devices. Alternatively you can try to setup an emulator that mimics a Clover device, see: https://docs.clover.com/build/android...

1 comment
10 |2000

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

niranjan avatar image niranjan commented ·

I have an android tablet and i have installed the clover engine in that tablet i can run clover example programs in that device.

0 Likes 0 ·
Bryanne Vega avatar image
Bryanne Vega answered niranjan commented
 CloverAuth.AuthResult authResult = CloverAuth.authenticate(this, account);
            if (authResult.authToken != null && authResult.baseUrl != null) {
                CustomHttpClient httpClient = CustomHttpClient.getHttpClient();
                String getNameUri = "/v2/merchant/name";
                String url = authResult.baseUrl + getNameUri + "?access_token=" + authResult.authToken;
                result = httpClient.get(url);

I use that if it's a Clover app to get any information I need with the appropriate permissions.

If it's an android app, set the app to OAUTH with the Clover website (Visit OAUTH wiki) and just trim the url

String url = api.clover.com/example/merchant?id=test
url.trim(url.indexOf(".com"))

Note, it's just a rough example.

1 comment
10 |2000

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

niranjan avatar image niranjan commented ·

Thank you very much

0 Likes 0 ·

Welcome to the
Clover Developer Community