Services

Kiwi offers a section of useful general services.

Country discovery

You can discover the country from IP...

    kiwiSDK.services().discoverCountry("IP", new DiscoverGeolocationListener() {
                    @Override
                    public void onSuccess(final Geolocation geolocation, String resolvedIpAddress) {
                    }

                    @Override
                    public void onError() {
                    }
                });

Or using the current user IP:

    kiwiSDK.services().discoverCurrentCountry(new DiscoverGeolocationListener() {
                    @Override
                    public void onSuccess(final Geolocation geolocation, String resolvedIpAddress) {
                    }

                    @Override
                    public void onError() {
                    }
                });

NOTE: This operation will be performed on background.

Retrieve current DateTime

You may want to obtain the current dateTime from a trustWorthy source, since the user can change it's device's clock. You can call services().retrieveDateTime() in order to do so. Please note that the time returned it's not linked to any timezone, it's an absolute time.

    kiwiSDK.services().retrieveDateTime(new RetrieveDateTimeListener() {
                    @Override
                    public void onSuccess(final DateTimeResponse dateTimeResponse) {

                    }

                    @Override
                    public void onError() {

                    }
                });

NOTE: This operation will be performed on background.

Last updated