Search code examples
androidzendesk

Zendesk Android : Exception on creating tickets


I have used following code to integrate ZenDesk with my application.

ZendeskConfig.INSTANCE.init(this, getResources().getString(R.string.zendesk_url), getResources().getString(R.string.zendesk_appId), getResources().getString(R.string.zendesk_clientkey), new ZendeskCallback<String>() {
            @Override
            public void onSuccess(String result) {

            }

            @Override
            public void onError(ErrorResponse error) {

            }

        });

        ZendeskConfig.INSTANCE.setContactConfiguration(new BaseZendeskFeedbackConfiguration() {
            @Override
            public String getRequestSubject() {
                return "Save The Date";
            }
        });
        Identity user = new AnonymousIdentity.Builder().build();
        ZendeskConfig.INSTANCE.setIdentity(user);

        ZendeskConfig.INSTANCE.setCustomFields(getCustomFields());

when trying to create Tickets getting following exception in Logcat.Please help me.

E/BaseProvider: Time in UTC: 2016-02-09T05:48:11Z 02-09 11:18:11.970 4061-4061/? E/BaseProvider: The expected type of authentication is null. Check that settings have been downloaded. The local identity is present. The local identity is anonymous. 02-09 11:18:11.970 4061-4061/? E/ZendeskFeedbackConnector: Network Error: false, Status Code: -1, Reason: The expected type of authentication is null. Check that settings have been downloaded. The local identity is present. The local identity is anonymous.


Solution

  • When are you trying to create a ticket? ZendeskConfig.INSTANCE.init is asynchronous, when the method returns the SDK is not guaranteed to be initialized, hence the onSuccess callback. So for example if you are trying to create a ticket with a provider call right after initializing the SDK chances are it will fail.

    Currently the best solution is to wait until onSuccess is called before attempting to create a ticket. This timing issue will be removed in the next release of the Android SDK, which will be before the end of the week. It will be removed from the iOS SDK soon after.